"MongoDb not running on the provided host and port " error

Cannot connect.


Are you logged into your MongoDB Atlas, if your are not; the cluster is not active and you wont be able to connect.
Also you shouldn’t need to specify the Replica Set Name, it should just use an active replica.(I only mention this for debugging!)
Good Luck!

Thanks for your prompt response.
How do i log into MongoDb Atlas ?


Apologies as i now relies that this is for a different chapter. :flushed:
Try changing the Read Preference to Primary Preferred? Other than that looks good.
Again sorry for any confusion.

Tried “Primary Preferred”. Did not connect, the same issue.

Which version of compass you are using?
Any firewall issues
IP whitelisted?
Are you able to connect with shell
Are you able to ping server?
Please check this

Cannot connect to Cluster: MongoDB not running on the provided host and port

Still not connected.

  • Version of the compass is 1.18.0.
  • Firewall test passed.
  • No IP whitelisted. What will be the IP and how do I whitelist them?
  • How do I connect by shell?
  • Ping passed:pasted below.

C:\Users\H216972>ping cluster0-shard-00-00-jxeqq.mongodb.net

Pinging ec2-34-195-121-130.compute-1.amazonaws.com [] with 32 bytes of data:
Reply from bytes=32 time=38ms TTL=46
Reply from bytes=32 time=47ms TTL=46
Reply from bytes=32 time=37ms TTL=46
Reply from bytes=32 time=41ms TTL=46

Ping statistics for
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 37ms, Maximum = 47ms, Average = 40ms


am having similar issues

but i get this error “connection 7 to cluster0-shard-00-00-jxeqq.mongodb.net:27017 closed”

Is it stable version?
did you try to restart compass
Whitelist means it will allow you to login from anywhere
Please check our forums.Steps available with snapshots
Command to connect from shell

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

Hi @Rajib_37939,

Please check the following post for your issue:


Please follow these steps to whitelist IP:

  • Login into your Atlas account and Click on Network Access tab under Security Section


  • Then click “IP Whitelist” followed by “Add IP Address”. If there is already any IP address, click Edit under Actions setion.

  • Finally, click “Allow Access from Anywhere” and click “Confirm”.

Please let me know, if you are still facing any issue.


Hi @David_00619,

Please share the connection string you have used and also the complete screenshot of the error.


Hi Sonali,

Thanks for the concern…I figured it out and is working now.

I am also got this issue. how I can fix this?

Did you try to restart compass?
Please check your connections parameters also

Hi @Suraj_13190,

As mentioned by @Ramachandra_37567, please try to restart compass. If it doesn’t work, then share the screenshot of the compass connection parameters.

Are you able to connect using the mongo shell?


Did you try to restart compass and Pc
please check your connections parameters also

Having the same issue, cannot connect. Anyone sorted this out yet?

I can connect to my personal cluster, but I have not been able to connect to the cluster provided. Anyone connected yet? Pinged the host, ping is active.

Hi, I have also facing the same issue…