Unable to initiate connection to sandbox. NSLOOKUP fails

Unable to initiate connection to sandbox. NSLOOKUP fails.

My connection string:
mongo “mongodb+srv://sandbox.mty4ywf.mongodb.net/myFirstDatabase” --username m001-student

Connection info from Mongo Atlas portal:

Switch up your dns resolver. Its working fine:

mongosh --quiet "mongodb+srv://sandbox.mty4ywf.mongodb.net/myFirstDatabase" --eval 'db.hello().ok'
1

The drivers look up SRV and TXT records in dns and connect using the hosts, ports and connection options returned from them:

nslookup -type=any sandbox.mty4ywf.mongodb.net
Server:		127.0.0.53
Address:	127.0.0.53#53

Non-authoritative answer:
sandbox.mty4ywf.mongodb.net	text = "authSource=admin&replicaSet=atlas-1ar142-shard-0"
sandbox.mty4ywf.mongodb.net	service = 0 0 27017 ac-nhc98eg-shard-00-00.mty4ywf.mongodb.net.
sandbox.mty4ywf.mongodb.net	service = 0 0 27017 ac-nhc98eg-shard-00-01.mty4ywf.mongodb.net.
sandbox.mty4ywf.mongodb.net	service = 0 0 27017 ac-nhc98eg-shard-00-02.mty4ywf.mongodb.net.

Authoritative answers can be found from:
2 Likes

Thank You. This was a good suggestion. I updated to use Google DNS and it works now.

1 Like

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