Mongodb remote database connectivity error - getaddrinfo ENOTFOUND

Created a database in free MongoDB Atlas cloud in AWS, downloaded MongoDB Compass Community in Windows10, testing my connection using Compass. I have pasted my connection string in Compass under “New Connection” tab as : mongodb://my_user:my_pwd@mycluster-u8ha7.mongodb.net:27017/my_db
and clicked “Connect”. I am getting following error: getaddrinfo ENOTFOUND mycluster-u8ha7.mongodb.net.

Can someone pls guide me how to troubleshoot and make this remote connectivity working from my local laptop? Just started playing around with MongoDB. So looking for the initial push to move forward. Thanks in advance.

That does not look like a connection string from Atlas.

You can get one from the connect button on your cluster.

https://docs.atlas.mongodb.com/connect-to-cluster/#connect-to-a-cluster

2 Likes

Thanks Chris for your response. I got the right connect string from Atlas as you have suggested. Initially when I was using mongodb+srv I was getting error, after installing dnspython everything started working. Thanks again.

1 Like

I am also having an error reason of which is unknown to me. Am giving the connect string given to me from Mongo and applying it to my compass but its showing an error over and over again.
Same error is also coming when am trying to connect to it from my application’s node.js driver
mongodb+srv://sam:<password>@cluster0.tpvpc.mongodb.net/bot
I have replaced the the password tag with actual pass while requesting

Can you connect by shell?
Is your hostname correct
Can you ping your cluster hosts
Make sure no spaces/invalid characters while pasting the connect string in Compass
or it could be some program blocking the port like antivirus

Most likely your internet provider is using an old DNS server and do not understand seedlist queries. Try using 8.8.8.8 and 8.8.4.4 google’s DNS server.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.