Unable to Connect to MongoDB Atlas Cluster Due to DNS Resolution Issue

I am unable to connect to my MongoDB Atlas cluster using the mongosh shell or any other MongoDB client. The error I’m encountering is:

Error: querySrv ENOTFOUND _mongodb._tcp.cluster.mongodb.net

Additionally, when I try to resolve the hostname (cluster0-shard-00-00.mongodb.net) using nslookup or ping, I receive the following error:

cluster0-shard-00-00.mongodb.net: nodename nor servname provided, or not known

Steps I’ve Taken*

  1. Verified the Connection String:
    I am using the correct connection string provided in the MongoDB Atlas dashboard:

mongodb+srv://:@cluster0.mongodb.net/?retryWrites=true&w=majority
2. Checked DNS Settings:
I have set my DNS servers to Google Public DNS(8.8.8.8 and 8.8.4.4).
I have flushed the DNS cache using:

sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder

  1. Tested Connectivity:
    I attempted to use telnet to connect to the cluster’s IP address, but the hostname resolution failed.
    I also tried using a direct connection string (replacing mongodb+srv with mongodb), but the issue persists.
  2. Checked Firewall and Network:
    My firewall allows outbound connections to port 27017.
    My IP address is whitelisted in the MongoDB Atlas dashboard under Network Access

Additional Information:

MongoDB Atlas Plan Free Tier (M0)
Operating System: macOS
MongoDB Shell Version: mongosh 2.4.2


Request:

Could you please assist me in resolving this DNS resolution issue? Specifically:

  1. Are there any known issues with the SRV records for my cluster?
  2. Is there a way to bypass the SRV records and connect directly to the cluster?
  3. Are there any additional steps I can take to troubleshoot this issue?

Thank you for your assistance!

Hi @Umm_Aaliyah ! Are you able to connect to your MongoDB Atlas cluster using Compass or code? Your connection string appears to be in the correct format.