Connecting to atlas through shell

I am having trouble connecting. I have looked through some of the posts and not found an answer. I have tried overwriting the .shell file, manually typed the connection and rebooted. I can connect through compass. Any suggestions? Capture Thanks

@Kurt_31421 … “test” is not part of the collections in the cluster hence the error you are getting (I think).
I changed mine to “100YWeatherSmall” and successfully connected. MongoDBUniversity_Chapter2_02052019

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

Please use the above command to connect to Mongo Atlas cluster.

The error in your connect command was the Replica Set Name, it is Cluster0-shard-0 and you were using Cluster0-shard0, just a small hyphen was missing. :slight_smile:

Kanika

I still have the same issue connecting using the command listed above. Also I have set up a my own test cluster on atlas and have the same issue. And attempted to connect from a different network. There has some step that was missed or some setting that needs changes. Is mongodb so finicky that you can’t copy and past a connection string and connect?

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

Did you try connecting from Compass does it work ?

I can connect to both the class and cluster I created in compass with no problems.

From the error it looks like shell is unable to connect to cluster. The only steps I remember from video are set the env variable for mongo in settings and then click the cluster in sandbox and get the connect string. Bring up the shell and connect to the sandbox. Did you try connecting to the default one ?

I set the path environmental variable. No luck connecting to class cluster.

I know this might be frustrating for you but I think this might be some minor typo. Maybe constructing the string and copying to notepad(not word) might help. Do you know why you made mistake first time ? I mean how did the cluster name change ? Try copying the string and connecting again. I’m behind firewall otherwise I can connect and check for you

I copy the string directly from the class notes to notepad++ to verify the password and quotes are correct.

Same with the atlas cluster I created. Copy directly from atlas to notepad and add password.

I’m having this same issue. Copied and pasted from the class notes. Also tried changing the database from test to 100YWeatherSmall and still no luck.

I am not able to connect using the command u shared. It still gives error.

Please exit the Mongo shell before running the command.

Instead of running mongo --nodb, you need to type the command I sent like this:

 C:\Users\piypraka> 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/video?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

Kanika

1 Like

kanikasingla,

Do you have a resolution to the original question I posted 2 days ago? As is seems now MongoDB is buggy and has no business in any real production environment. This is a simple 101 tutorial that should be able to be completed in a short time. Thanks

1 Like

I am sorry for the delayed response. The intention was not to generate frustration among students.
Please help me in identifying the issue here so that I can help you solve it.

This error only appears when the internet is not working properly OR your system is unable to ping the cluster.

Try running the below command from your system:

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

And run this command from your terminal (Not from Mongo shell) and paste the exact command you are using and let me know what it shows:

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

Also, check for firewall, if it is blocking network requests to the cluster.

Kanika

2 Likes

My internet works just fine.

Here is the ping:

Here is the command I ran:
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/video?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

here are the results:

Let me know if there is something different I should be trying. Thanks.

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
2019-02-07T23:00:56.507+0530 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6
MongoDB Enterprise > 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/100YWeatherSmall?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
2019-02-07T23:21:41.166+0530 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6
MongoDB Enterprise >

I am getting this error.Can anyone please help me

you need to exit out of shell

Please anyone help me to solve this error.

exit out means what?I am not able to understand.