Search code examples
mongodbdnscluster-analysismongodb-atlasmongodb-compass

Why I am unale to connect to my Atlas Cluster?


I am learning basic course of MongoDatabase at Mongo University, and I am Unable to connect my own Cluster.
Although I have named my cluster differently which is StockMarketAnalysis.

mongo "mongodb+srv://sandbox-xxxxx.mongodb.net/test"  --username m001-student --password m001-mongodb-basics

Output I am getting

DNSHostNotFound: Failed to look up service "":DNS name does not exist.
try 'mongo --help' for more information

After doing npm as one of given below answer

enter image description here

I am still not able to do it


Solution

  • I've had the same problem while following the instructions on MongoDB University. The problem here is before running the following code you'll have to edit the xxxxx to the one found in your connection string. The following was just a generalized sandbox code.

    mongo "mongodb+srv://sandbox-**xxxxx**.mongodb.net/test"  --username m001-student --password m001-mongodb-basics
    

    It would be different for your own sandbox.It would be something like :

    mongo "mongodb+srv://sandbox-**byutb**.mongodb.net/test" --username m001-student --password m001-mongodb-basics
    

    I hope this was helpful.