Error while connect to cluster from Mongo shell

I am giving this command as per lecture notes:
mongo “mongodb://,,” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

but getting this error:
2019-08-09T15:01:41.633-0400 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:clock6:
Can you please help?


This error means you are already inside the mongo shell. First you need to exit out of the mongo shell by using the quit() command.


Now you can use your connection string to connect to the cluster.

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

Shubham Ranjan
Curriculum Support Engineer


I was able to connect, but soon I m getting this error:

2019-08-09T16:34:42.541-0400 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2019-08-09T16:34:42.548-0400 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/,, :
exception: connect failed


Please make sure you are not behind a firewall or using a VPN connection. Follow the steps mentioned below to check if you are able to reach the cluster and your port (27017) is not blocked.

Please share the screenshot of the responses or any error that you get.

Shubham Ranjan
Curriculum Support Engineer