I can't connect to the Cluster

Hi everyone!!

I have an issue trying to connect to the cluster following the instructions from " Connecting to Our Class Atlas Cluster from the mongo Shell", chapter 2, I followed all the instructions to install and set my connection, but, when I paste the code from notes:

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

(using the “copy” button), then show me this error

2019-07-25T12:41:15.971-0700 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6

I use quit() and reopen my terminal and the error keeps.

Also, I tried to use another command, like “show dbs” and response with similar error.

Can you guys help men??

(I downloaded the latest mongo db version (from the notes) and I have macOS Sierra)

When you run the first

mongo --nodb

it puts you inside a mongo shell try to exit out of the mongo shell and run the connection command outside the mongo shell.

1 Like

Hi @Mario_55431,

As @natac13 mentioned you are already inside the mongo shell that’s why you are not able to connect to the cluster. To exit out of the mongo shell, you can use the quit() function.


After exiting out of the mongo shell you can use the connection string to connect to the cluster.

If you still have any query, feel free to get back to us. Happy Learning :slight_smile:

Shubham Rajan
Curriculum Support Engineer

1 Like