Getting SyntaxError

following directions in Lecture notes.
Chapter 2: The MongoDB Query Language + Atlas
Connecting to Our Class Atlas Cluster from the mongo Shell
getting error:
C:\Users\imcdonald>mongo --nodb
MongoDB shell version v4.0.3

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
2018-10-17T15:55:27.623-0400 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6

picture is attached
pix

Hi Irina, it looks like you forgot to replace the string “test” with an actual database name inside the cluster0 connection. “test” is not an existing database. Try replacing it with “video” or “100YWeatherSmall” like this:

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

1 Like

Hi Irina_25807,

Please run the command from outside the mongo shell. Check here

Let me know if it doesn’t work!

Thanks, Kanika

It worked great - thank you!
now I’m getting different warning WARNING: shell and server versions do not match
MongoDB server version: 3.6.8
MongoDB shell version v4.0.3

Hi Irina_25807,

It is just a warning, you can continue working on the mongo shell. For the explanation of Warning:

shell & server versions do no match

It means the version of your system i,e 4.0.3 (I am assuming) and the server version (to which you are connecting i.e cluster0-shard-00-00-jxeqq.mongodb.net is using different version i.e 3.6.8

However, if you connect on your shell using mongo --nodb it will show MongoDB shell version v4.0.3 which will match your shell version, so it won’t throw any warning.

I hope it clears the confusion!

Kanika

1 Like

This was my question and understanding. Thanks for already confirmation.

1 Like