Unable to connect mongo cluster from mongo shell

mongo “mongodb+srv://jacob-m001-jwn51.mongodb.net/test” --username m001-student

Hi @Jacob_28713,

Can you please share the error message that you are getting when you are trying to connect ?

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Same Here:
mongo “mongodb+srv://cluster0-vjar2.mongodb.net/test” --username m001-student

This connet me to 127.0.0.1:27017
Error: HostUnreashable: Connection reset by peer

Hi! I had the same problem. I have just tried another command line string from an old Mongo Shell version(3.4 or earlier),it has worked for me. :slight_smile:

Hi @Matthew_97151,

I am able to ping your cluster. So, it’s up and running.

Can you please share the screenshot of the output you are getting when you are running this command?

Additionally, please share the password for this user m001-student, so that I can test it at my end.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

the password is: m001-password

Hi @Matthew_97151,

I’m able to connect to your cluster.

Can you please make sure you are able to ping the cluster by running the following command in your terminal ?

 ping cluster0-shard-00-00-vjar2.mongodb.net

Please make sure you are not connected to any VPN network and Firewall/Anti-virus is not blocking connection request to/from your local network.

If that is the case then contact your network administrator or try to connect from some other network such as your home network.

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer

It can be connected now and i hv just completed the course, thanks.

I am not able to connect to shell. following is the error am getting.

It is prompting for password.Have you given the password?
Authentication error means wrong combination of userid/pwd
If you have problem in typing password use it in command line as below

mongo “mongodb+srv://cluster0-eemes.mongodb.net/test” -u m001-student -p xyz

I used the same command but still getting error.
my password is m001-mongodb-basics

I was able to connect with above password but today it failed when i tried again
May be some network issue or your cluster may not be up

Snapshot from yesterday:

C:\Users>mongo “mongodb+srv://cluster0-eemes.mongodb.net/test” -u m001-student -p m001-mongodb-basics
MongoDB shell version v4.0.5
connecting to: mongodb://cluster0-shard-00-00-eemes.mongodb.net.:27017,cluster0-shard-00-01-eemes.mongodb.net.:27017,cluster0-shard-00-02-eemes.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true

MongoDB server version: 4.0.13
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db
test

Hi Shubham,

Do you have any idea how to fix this error?

I deleted that cluster and created another. Today I tried to connect from another network and it worked. Thanks for reply.

Hi @kranthi_54091,

I’m glad your issue got resolved. If you have any other query then please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Hi @Kathy_Lois_14695,

As I can see in the screenshot, your connection string is missing some characters. Please append -- as a prefix in the username parameter.

The complete connection string is :

mongo "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?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

Please run this command in your terminal and outside of the mongo shell.

Hope it helps!

If you have any other query then please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer