Using the mongo shell and compass
Last updated
Was this helpful?
Last updated
Was this helpful?
Use this article: โ
Use this command:
mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
Because you are connecting to a cluster, you need to give the Mongo Shell the name of all the servers in the cluster.
To connect to another database change the word test in the command
To make a secure connection use: ssl
Then use the username and password
To list databases on your current sandbox cluster: show dbs
To show the collections in that database: show collections
If you want to change the database use: use DBNAME
Use the same command that was used for the first time you connected something from the database to the shell, with your username and password.
The only important thing here is to find the primary cluster. Then fulfill the form, and use the same username and password as before.
โโ
Detailed instructions found here: โ