Can't connect to atlas cluster from shell

I have a problem. I tried to use the command of the class:

C:\Users\Edmundo>mongo “mongodb+srv://cluster0-jxeqq.mongodb.net/test” --username m001-student -password m001-mongodb-basics
MongoDB shell version v4.2.5
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?compressors=disabled&gssapiServiceName=mongodb&ssl=true

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2020-03-26T13:50:14.008-0500 E QUERY [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-03-26T13:50:14.013-0500 F - [main] exception: connect failed
2020-03-26T13:50:14.013-0500 E - [main] exiting with code 1

Then I tried again in powershell because that was a recomendation but didn´t work:

PS C:\Users\Edmundo> mongo “mongodb+srv://cluster0-jxeqq.mongodb.net/test” --username m001-student -password m001-mongodb-basics
DNSHostNotFound: Failed to look up service “”:Se devolvi├│ esta operaci├│n porque se agot├│ el tiempo de espera.
try ‘C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe --help’ for more information

Help :slightly_frowning_face:

Pd: I can enter to the Outgoing Port Tester btw

Outgoing port tester

This server listens on all TCP ports, allowing you to test any outbound TCP port.

You have reached this page on port 27017 .

Your network allows you to use this port. (Assuming that your network is not doing advanced traffic filtering.)

You’re having the same problem with this poster. Feel free to read through that thread.

This connection string should work:

mongo "mongodb://m001-student:m001-mongodb-basics@cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?authSource=admin&replicaSet=Cluster0-shard-0&ssl=true&readPreference=primary"

1 Like

How do I whitelist my IP? It appear my first error

Use the connection string above and share a screenshot. I need to see what you did.

Ignore that message. You can’t Whitelist the IP for the public Class cluster. For your private Sandbox cluster you can.

Well, I don’t know why but it works now :smile: thanks!!

It was always going to work :wink: Happy learning! :grinning:

Hi @Edmundo_92011,

Not all DNS providers or routing systems support the SRV protocol that’s why the srv connection didn’t work for you. Thanks for surfacing this, I will update the lecture notes.

~ Shubham