M001 Lab failure to connect to DB

user@M001# mongo “mongodb+srv://sandbox.hao33za.mongodb.net/Sandbox” --username m001-student
MongoDB shell version v4.4.3
Enter password:
connecting to: mongodb://ac-5oyudpv-shard-00-01.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-00.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-02.hao33za.mongodb.net:27017/Sandbox?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-g9f913-shard-0&ssl=true

*** 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-g9f913-shard-0/ac-5oyudpv-shard-00-01.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-00.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-02.hao33za.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed

I am really frustrated at this and after searching through the forum, I cannot get an answer as to why I cannot connect. Also, the IDE is so SLOW.

My IP is whitelisted and still get the error.

Any other suggestions?
0.0.0.0/0 - give me bad auth which I know is incorrect - even resorted to one finger typing to make sure everything was correct.
and my own ID throws the error above
also I followed the guides 100%.

@Fabio_Faria are you behind a corporate firewall?

Just confirming that when opening up your Network Access List to 0.0.0.0/0 you received a bad auth error?

If your DBUser password contains a special character ($,@, etc.) could you reset your password to something without these and test whether you still receive a bad auth error?

If this resolves the issue for you, it is likely due to a need for URL encoding to escape the special characters.
A tool for encoding text can be found here

hi @Jack_Woehr no just my personal broadband

Hi @Steve_Hunt.
I have use my own IP and it provides the error above.
when using 0.0.0.0/0 I get a bad auth error:
user@M001# mongo “mongodb+srv://sandbox.hao33za.mongodb.net/myFirstDatabase” --username m001-student
MongoDB shell version v4.4.3
Enter password:
connecting to: mongodb://ac-5oyudpv-shard-00-01.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-00.hao33za.mongodb.net:27017,ac-5oyudpv-shard-00-02.hao33za.mongodb.net:27017/myFirstDatabase?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-g9f913-shard-0&ssl=true

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

Error: can’t connect to new replica set master [ac-5oyudpv-shard-00-01.hao33za.mongodb.net:27017], err: AuthenticationFailed: bad auth : Authentication failed. :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1

I have changed the password to only contain lower and upper case characters and still fails.

Again, with my IP on the list, error above, 0.0.0.0/0 I get a bad auth error

Thanks Fabio,

I’ll send you a private message, if you’re comfortable sending me a link to your Atlas console in private I’ll take a look at some logs and get back to you

Hi is there anyone else that can help with this issue?

After checking with my ISP i had to open a port on the router to allow I to connect.
Thanks for all the help :slight_smile:

3 Likes