Skip to main content
MongoDB accounts let you manage access to your MongoDB databases. Users connect through the CLI (a local proxy), and every session is recorded.

Creating an Account

1

Start adding an account

Go to Privileged Access Management → Accounts and click Add Account.
2

Select a folder and template

Choose which folder to add the account to, then select a MongoDB template.
3

Enter connection details

FieldDescription
NameA descriptive name (e.g., users-db)
Connection StringMongoDB URI (see below)
DatabaseDatabase name (default: admin)
SSL EnabledEnable SSL for the connection
Reject UnauthorizedReject connections with invalid certificates (only if SSL enabled)
SSL CertificateCustom CA certificate (only if SSL enabled)
The connection string supports both mongodb:// and mongodb+srv:// URIs. Do not include credentials or database name in the URI — use the separate fields instead.Example: mongodb://mongo.example.com:27017 or mongodb+srv://cluster.example.com
4

Enter credentials

FieldDescription
UsernameMongoDB username
PasswordMongoDB password
5

Save

Click Create.

Connecting

The CLI starts a local proxy that you connect to with your preferred MongoDB client.
infisical pam access my-folder/users-db
The command outputs the local port to connect to. Then use mongosh or any MongoDB client:
mongosh "mongodb://localhost:<port>/users"
No password needed since the proxy handles authentication. Flags:
  • --port <port> — use a specific local port (otherwise one is assigned automatically)
  • --reason <reason> — provide an access reason (if required by template)

Next Steps

PostgreSQL Accounts

Add PostgreSQL database accounts.

Sessions

View and manage sessions.