Cannot connect to mongo cloud

Help! I cannot connect to the cluster from mongo shell. I can connect from the course IDE, but not locally.
Did anyone had the same problem?

You should be able to connect from localhost also
What connect string you used and what error are you getting?
A screenshot of error will help in troubleshooting the issue

1 Like


This is from mongo shell


And this one is from compass

I can connect by both shell and Compass
I use mongo not mongosh

Did you try with --tls in shell?

For compass you are choosing more options tab
Did you try with hostname tab with cluster0-shard-00-01-jxeqq.mongodb.net as hostname

I tried with other clusters, and the same error (in compass i chose more tabs, changed clusters, everything).
Isn’t mongosh the command for mongo shell? Also, using --tls doesn’t help.
Maybe you can check out my connection string.
Also, what do I need to have installed for mongo shell? Maybe it’ something wrong with that.

Thank you!




Check this link

Getting error while connecting using Compass - getaddrinfo ENOTFOUND url

Did you try from another location/network or with hotspot of yoour mobile

Yes mongosh is the command for shell.It is the latest version of shell
Earlier it was mongo
Your mongo command is failing because what you have installed is mongosh

Try this connect string for Compass and see if it works

mongodb://m121:aggregations@cluster0-shard-00-00-jxeqq.mongodb.net:27017/aggregations?authSource=admin&replicaSet=Cluster0-shard-0&readPreference=primaryPreferred&appname=MongoDB%20Compass&ssl=true

2 Likes

Hey, I hope it is working fine for you now. If not try this. I was also facing the same issue and did like this to resolve.

  1. Open your command prompt. And paste the connection string that was provided in the first chapter in it.
  2. Now, replace ‘mongo’ with ‘mongosh’ if you have installed mongosh(if do not have mongosh, install it).
  3. And finally change --ssl to --tls.

You should be connected now.
Thanks.