Unable to connect mongocluster from mongo shell

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-09-26T00:11:06.325-0700 E QUERY [js] uncaught exception: SyntaxError: unexpected token: string literal :
MongoDB Enterprise >

Hi @padmaja_37395,

You are already inside the mongo shell and connected to a monogd instance that’s why you are getting this error.

For connecting to the Atlas class cluster you need to exit out of the mongo shell first and then run the command in your Terminal / Command Prompt.

To exit out of the mongo shell, please run the command mentioned below


Now run this command in your terminal for connecting to the atlas class cluster.

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

If you still face any issue, please feel free to get back to us.

Happy Learning :slight_smile:

Shubham Ranjan
Curriculum Support Engineer

1 Like

Thank you.Issue is resolved now.I tried from cmd prompt