Connection Issue: MongoDB Compass - ENOTFOUND Error for Cluster Address

I’m experiencing an issue with connecting to my MongoDB Atlas cluster using MongoDB Compass. When I try to connect, I receive the following error:

MongoDB connection error: Error: querySrv ENOTFOUND _mongodb._tcp.surf-spot-finder-cluster.abcd.mongodb.net

Connection String:

mongodb+srv://username:password@surf-spot-finder-cluster.abcd.mongodb.net/sample_mflix?retryWrites=true&w=majority

Error Message:

querySrv ENOTFOUND _mongodb._tcp.surf-spot-finder-cluster.abcd.mongodb.net

Troubleshooting Steps Taken:

  • Verified that the connection string is correct.
  • Ensured my IP address is whitelisted in MongoDB Atlas.
  • Confirmed that the subdomain (abcd) is accurate.
  • Ran nslookup and ping, which show issues with resolving the domain.

Environment Information:

  • MongoDB Compass version: 1.31.0
  • Operating System: Windows 10
  • Cluster Name: surf-spot-finder-cluster

Request for Help:

I would appreciate any guidance on how to resolve this DNS issue or if there’s a potential problem with my MongoDB Atlas setup.

Thank you!

As you seem to suspect (ran nslookup) means the cluster name is wrong.

It really appears that there is no cluster at surf-spot-finder-cluster.abcd.mongodb.net.

May be the cluster is not ready yet?

Did you get the connection string from cut-n-paste in Atlas GUI or you created it by concatenating subdomain. In some regions, a dash separates the cluster name and the subdomain, and in others it is a dot. Make sure you cut-n-paste from Atlas GUI.

I find the subdomain abcd to be a too short of string and too normal. I am used to things like k4dcb2, more cryptic rather than simple abcd.

This type of issue usually happens when your DNS can’t resolve SRV records.
Can you try switching to Google’s DNS (8.8.8.8, 8.8.4.4) or Cloudflare’s (1.1.1.1)?