skip to content
Alvin Lucillo

Credentials in mongodb URI

/ 1 min read

Though it’s shorter, it’s advisable to allow a password prompt by not specifying the credentials in the URI because using the full command containing the credentials can end up in shell history. But for demo purposes, this is the format.

mongosh "mongodb+srv://adm1n:<redacted>@cluster0.laaztrd.mongodb.net/"
Current Mongosh Log ID: 69fb3a07525c7b7043544cb7
Connecting to:          mongodb+srv://<credentials>@cluster0.laaztrd.mongodb.net/?appName=mongosh+2.3.8
Using MongoDB:          8.0.21
Using Mongosh:          2.3.8
mongosh 2.8.3 is available for download: https://www.mongodb.com/try/download/shell

For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/

Atlas atlas-d4991z-shard-0 [primary] test>