docs/documentation/platform/pam/accounts/mongodb.mdx
MongoDB accounts let you manage access to your MongoDB databases. Users connect through the CLI (a local proxy), and every session is recorded.
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`
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)