Connection to atlas cluster from shell

what is the conection string i should use to connect to mongo db atlas cluster from shell as per the documentation we created sandbox cluster

The connection string is given by Atlas when you create the cluster. This is explained in the lesson where you are asked to create a cluster.

1 Like

In the mongo basics course the cluster was created by trainer and iam practising in the IDE to connect to it si i dont have connection string

Not that I remember.

In my version of the course, in chapter 1, you create your own cluster in Lab: Create and Deploy an Atlas Cluster*.

And then, in Lab: Connect to your Atlas Cluster it is shown how to connect to your cluster.

Hi @Sindhu_Puchakayala,

I hope you are doing well.

As, @steevej stated you have to visit the MongoDB Atlas Cloud and sign in yourself to create your own free cluster, and there you will be getting your own personal free tier of Atlas with 500MB of space.

If you need further assistance feel free to reach out to us.


Hmm i created my own cluster and got the connetion string and iam trying to connect to my cluster from shell and iam getting below error.

mongo “mongodb+srv://” --username sisira
DNSHostNotFound: Failed to look up service “”: Connection refused

Hi @Sindhu_Puchakayala,

Thanks for reaching out to us.

There could be the majority of two issues due to which you might be facing trouble connecting with the cluster.

  • First, check your IP is whitelisted or not in the Network Access tab of your Atlas cluster account. We suggest you use (which includes your current IP address also) for your University Courses.
  • Secondly, make sure that you are not connected to any VPN network and the firewall/anti-virus is not blocking connection requests to/from your local network? If yes, try to connect from some other location such as your home network.

If the problem still persists, I will suggest you use the non-srv string (found in MDB version 3.4 or less) which you will find in your MongoDB atlas account's connection tab by changing the MongoDB version. :point_down:

Let me know if there is any further question. We will be happy to help.


Looks like your internet provider does not support the modern seedlist DNS entry.

Try to use Google’s and DNS servers.


Thanks for quick reply but unfortunately both these options didn’t work.On the day 1 of my atlas cluster install iam able to connect to atlas cluster now iam facing these connection errors. i have in my network access and i even tried with mongo version 3.4 or earlier but getting this error
[osboxes@osboxes ~]$ mongo "mongodb://,," --ssl --authenticationDatabase admin
{“t”:{"$date":“2021-04-29T17:26:39.005Z”},“s”:“W”, “c”:“CONTROL”, “id”:23321, “ctx”:“main”,“msg”:“Option: This name is deprecated. Please use the preferred name instead.”,“attr”:{“deprecatedName”:“ssl”,“preferredName”:“tls”}}
MongoDB shell version v4.4.5
connecting to: mongodb://,,
{“t”:{"$date":“2021-04-29T17:26:54.094Z”},“s”:“I”, “c”:“NETWORK”, “id”:4333208, “ctx”:“ReplicaSetMonitor-TaskExecutor”,“msg”:“RSM host selection timeout”,“attr”:{“replicaSet”:“atlas-orulpz-shard-0”,“error”:“FailedToSatisfyReadPreference: Could not find host matching read preference { mode: “nearest” } for set atlas-orulpz-shard-0”}}

*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

Error: connect failed to replica set atlas-orulpz-shard-0/,, :
exception: connect failed
exiting with code 1

Hi @Sindhu_Puchakayala,

Thanks for your updated response.

So, you have

  1. Whitelisted your IP. :white_check_mark:
  2. Tried with srv as well as with non-srv string. :white_check_mark:

and the problem still persists.
Then, there is a high probability that your ISP is blocking the port 27017. :no_entry_sign:

Refer to my second point. :point_down:

Hope it helps…!!
Let me know if it gets resolved or not.



Iam connecting from home network only and couple of days back i am able to connect to atlas cluster only today i started facing this issue not sure and no changes as well

Hi @Sindhu_Puchakayala,

Thanks for your response.
Can you kindly share your connection string so, we can check it from our end?



mongo “mongodb+srv://” --username sisira

Any reason why you are not using the IDE as you are supposed to do?