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

Hi, I need your help.

Hi @Angela_Crespo,

Welcome to the MongoDB Community Forum,

I highly recommend you to ensure that your IP is whitelisted or not in the network access tab which you will find in your atlas cluster. We suggest you use 0.0.0.0/0 (which includes your current IP address also) for your University Courses.

Hope it helps!
Feel free to reach out for any further assistance.

Thanks
Kushagra

Hello, How can I make sure that my IP is on that list?

Im trying to run my connection string in CMD
mongo “mongodb+srv://curso-plazi.erhv8.mongodb.net” --username platzi-admin

but when I insert the password I get the same error, what am I doing wrong? I appreciate your comment!

*** 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 [curso-plazi-shard-00-01.erhv8.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

@Kushagra_Kesav I used what you suggested and I still get the same error in the terminal.

Not really. Before you got exception: connect failed and that was solved by allowing 0.0.0.0. Now you get:

which means wrong user name or password.

1 Like

@steevej Thank you very much, I have just solved the problem. I just had to change the password and put my own, the one I had was the one suggested by mongo.

right now when I insert

mongo “mongodb+srv://curso-plazi.erhv8.mongodb.net” --username platzi-admin

in the Ubuntu console or in the Command Prompt it asks me for the password (I put the new one) and that’s it! I am so happy with the mongo community, thanks again!

I just have one last question, is there any way to connect from mongo shell to the cluster? because when I insert the connection string in mongo shell I get the following error:

mongo “mongodb+srv://curso-plazi.erhv8.mongodb.net” --username platzi-admin
uncaught exception: SyntaxError: unexpected token: string literal :
@(shell):1:6

You get the syntax error because you are already in the mongo shell. You have to exit and to than from where you enter the mongo command without argument.

see https://docs.mongodb.com/manual/mongo/

1 Like

Hi @Angela_Crespo,

I hope that your problem has been resolved.
If, there is any further question feel free to reach out.
We will be happy to help.

Regards,
Kushagra