Cluster connection error

[js] SyntaxError: missing ; before statement @(shell):1:6

getting the above error when executing the below command:
mongo “mongodb://,,” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

@Ravi_Srivastava_75555 Maybe try this
mongo “mongodb://,[](,[](” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

Unfortunately, your code shows me a different error on my PC. So it would take me sometime before I can figure out what must have gone wrong with your code.

(This is what I get while executing your code)
MongoDB shell version v4.0.5
exception: No digits

(N.B. It is suggested that you use the special tags provided here while attaching a code as it improves readability and separates it from the general content of discussion.)

EDIT : You missed a slash sign after third occurrence of 27017 (inside round brackets). Maybe it prevents looking into the database as the normal reference would look at the cluster but a reference ending with a / allows looking into it. Just a guess. I might be wrong.

I am stuck and unable to proceed.

@Ravi_Srivastava_75555 Have you tried the code that I provided you?

Yes I tried your code but it is in hang state … “…” is the outputand its stuck at there

@Ravi_Srivastava_75555 It is not in a hang state. The shell is waiting for your input. This generally occurs when you have left some brackets unclosed or some statement incomplete without their arguments. Try checking if all the brackets and quotes are complete.

I posted the exact snippet which you gave
mongo “mongodb://,,” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

@Ravi_Srivastava_75555 Try this.
mongo "mongodb://,," --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

You need to edit the double-quotes in the terminal before executing. Just delete the double-quotes and add them from the keyboard

1 Like

cut & paste commands sometimes don’t work due to junk/spaces or if it goes to second line
I tried your command and able to login without any issue
I disconnected from my previous session and logged with your command

MongoDB Enterprise Cluster0-shard-0:PRIMARY> exit
vagrant@m103:/dataset$ mongo mongodb://,, --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.9
connecting to: mongodb://,,
2019-01-20T05:22:59.744+0000 I NETWORK [thread1] Starting new replica set monitor for Cluster0-shard-0/,,
2019-01-20T05:23:01.030+0000 I NETWORK [thread1] Successfully connected to (1 connections now open to with a 5 second timeout)
2019-01-20T05:23:01.253+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to (1 connections now open to with a 5 second timeout)
2019-01-20T05:23:02.418+0000 I NETWORK [thread1] Successfully connected to (1 connections now open to with a 5 second timeout)
Implicit session: session { “id” : UUID(“95a43c29-e070-4700-a8b6-d20cd8bf55a9”) }
MongoDB server version: 3.6.9
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

1 Like

back to square 1 . Same error .
[js] SyntaxError: missing ; before statement @(shell):1:6

As @Ramachandra_37567 said, copying sometimes does not work as it greatly differs how spaces and breaks are addressed in your own browser’s formatting engine. Try snapping the terminal and browser windows side-by-side and typing the entire thing. Strangely enough, the code that I have just sent you works out of the box for me and I am unable to reproduce your error.

Are you intentionally using the old version of MongoDB Shell in order to attain total compatibility with the enterprise server version which hosts the class cluster? Smart move. :joy:

Please find attached the shell version I am using.image

That was a reply to @Ramachandra_37567

I am stuck . Can somebody help.

I got my answer. I was trying that inside shell.

I am having the same error

I did the same as [Ravi_Srivastava_75555]. Now I got connected. Thanks!

@Ravi_Srivastava_75555 Can you elaborate this? What exactly did you mean when you said

I was trying that inside shell.

im having an issue connecting to the atlas cluster. i copied exactly the code from the lecture.
mongo “mongodb://,,” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics.
But it keeps telling me [js] syntax error: missing ; before statement @(shell):1:6. i have tried the alternative code provided above but the cursor hangs at a position. i also tried typing the code and not copy paste but to no avail