Mongo shell connection error to Atlas cluster

I created a new MongoDB user, and allowed connections from anywhere in the IP Whitelist section.
I tried to connect using the CLI from windows 10, but I got a connection error.

This is the command:
mongo “mongodb+srv://cluster0-mpoaq.mongodb.net/test” --username m001-student

the cluster name is Cluster0 and the user I have created has the following credentials: username:m001-student
password:m001-mongodb-basics

after entering the password I got this error:

socket exception [CONNECT_ERROR] server [cluster0-shard-00-02-mpoaq.mongodb.net:27017] connection pool error: network error while attempting to run command ‘isMaster’ on host ‘cluster0-shard-00-02-mpoaq.mongodb.net:27017

The mongoDB shell version is 4.0.6

any help is appreciated
Thank you!

I think in your CLI you forgot to type the password in the command.

instead of:
mongo “mongodb+srv://cluster0-mpoaq.mongodb.net/test” --username m001-student

use:
mongo “mongodb+srv://cluster0-mpoaq.mongodb.net/test” --username m001-student --password m001-mongodb-basics

1 Like

Hi Abdul, thanks for the reply.
I forgot to mention that, after launching that command, the CLI requests the password. After entering it, I got the error

switching to another network solved the problem. Thanks a lot

Hi,
I have a similar issue. I tried mongo “mongodb+srv://cluster0-mpoaq.mongodb.net/test” --username m001-student --password m001-mongodb-basics.

But I get this result instead. How do I correct it?
image

The full view is image

Already responded in other thread
Ignore those warning messages
You are already at mongo prompt which means successfully connected to mongodb