M121 connection error to database

when I type the connection string
mongosh “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/aggregations?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --tls -u m121 -p aggregations

in the mongo shell it responds with: invalid URI
and on using it in the mongoDB GUI it timeout after 30 seconds

It appears that the place where you copied-pasted this comment from uses some weird quotation marks and mongosh thinks they are part of the URI. Other than that, the command looks good and it works for me.

Try copy-pasting this:

mongosh "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/aggregations?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --tls -u m121 -p aggregations


The same error keeps happening although I have mongo shell v6

It looks like you’re running the mongosh command and it’s asking you to then enter a connection string. You’ however are typing in the full mongosh ... command and that is why you’re getting errors. You type the full command at the command prompt window. From your command prompt type in the mongosh ... line and you should be able to connect then.

1 Like

Yeah that worked, Thank you for your help and sorry for my misunderstanding.

Glad things are working for you no Abanoub!

No need to apologize. We’re all here to learn, and help where we can. You had the courage to ask your question. There are others who had the same problem but didn’t ask, so you helped them as well


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.