How to connect MongoDB shell with replica set in Windows 10

mongodb shell version# 0.11.0(mongosh beta), MongoDB version # 4.4.1
I have installed the same in my Windows 10 PC. As it can be seen from the below screen shot it is connected to the local host. But I want to connect the same with Atlas Cluster with m121. Please suggest how to do so. I’m learning so please ignore if there is any fault in my approach.
The connection string is as follows :-
“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 --ssl -u m121 -p aggregations --norc

That connection string works well for me. Note, however, that you have the wrong type of quotes there.

Try copy-pasting this connection string:

"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"

Hi,
For me the mongodbshell is already connected to the mongodb server which is installed in my PC. I want to connect it with the m121 or any other remote cluster. How to do that?
I’m attaching the screenshot which I tried using the string you sent.

You need to exit first. You can do that with exit().

Then you reconnect to the right cluster with this command:

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 --ssl -u m121 -p aggregations --norc

Hi Massimiliano,

I did it. I figured it out what I was doing wrong. I was trying to connect using mongosh.exe hence the problem was arising. Now I have tried the same using powershell and it is successfully connected. Thanks. :blush: