Cant connect atlas server to mongo shell

Viewed 225

I am very new to mongodb and atlas. I am trying to connect my atlas server to mongo shell while learning web development. I am trying to run the command:

mongo "mongodb+srv://cluster0.6ss5b.mongodb.net/myFirstDatabase" --username Bruno

If i run on my internet without vpn, I get the error:

DNSHostNotFound: Failed to look up service "":This operation returned because the timeout period expired.
try 'C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe --help' for more information

Indicating that my ISP has blocked this for me. When I do connect a vpn, I am asked for the password to my username, and then get the error:

connecting to: mongodb://cluster0-shard-00-00.6ss5b.mongodb.net:27017,cluster0-shard-00-01.6ss5b.mongodb.net:27017,cluster0-shard-00-02.6ss5b.mongodb.net:27017/myFirstDatabase?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-kcfk5f-shard-0&ssl=true
{"t":{"$date":"2021-06-17T04:19:26.714Z"},"s":"I",  "c":"NETWORK",  "id":4333208, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM host selection timeout","attr":{"replicaSet":"atlas-kcfk5f-shard-0","error":"FailedToSatisfyReadPreference: Could not find host matching read preference { mode: \"nearest\" } for set atlas-kcfk5f-shard-0"}}


*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

Error: connect failed to replica set atlas-kcfk5f-shard-0/cluster0-shard-00-00.6ss5b.mongodb.net:27017,cluster0-shard-00-01.6ss5b.mongodb.net:27017,cluster0-shard-00-02.6ss5b.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1

I have already whitelisted all IPs for my cluster, set ip to 0.0.0.0/0 My user has admin privileges. While on vpn, i cannot open the url http://portquiz.net:27017/ which I read somewhere means that port 27017 is blocked for me. What do I do to connect atlas server to mongo shell?

1 Answers

Solved! was some problem with my router, everything worked fine when i used mobile hotspot to run the command

Related