Missing semi colon before statement in shell

i am getting this error while connecting to cluster , missing semi colon before 1:7102

It looks right …
Try closing out all background programs & restarting Windows. Then start fresh from the mongo shell.

@rehan_59764, please read this thread.

It lists a number of very common questions new students ask, including yours.

I would also suggest editing your screenshots so they only include the relevant information. You are currently showing a LOT of information about your workstation, which makes you more vulnerable online.

It does not. Rehan is trying to start the Mongo shell, from inside the Mongo shell.

1 Like

Looking at it closer … if I was not so tired from a long cold night at work AND the command line window was a little bigger … i would have caught it earlier …

Thanks for Clarification.

Heh, no worries :slight_smile:

Long, cold nights at work suck. Especially if they’re not spent with fun colleagues :expressionless:

Hang in there, get some sleep :slight_smile: I’ll be out of the running for three days, tied up at a course.

1 Like

for some reason when I type the following command, it gives me this error. How do i resolve this issue?

@Tawbin_17250 ,

Refer to:


It is not working because you are already inside the Mongo shell.

Exit the shell, then run the command from the Windows Command Line.


Wayne Cassity


after i write quit()
then typing the command to connect to ATLAS , it gives me connection failed error.
i am using mongodb 3.4.18

Hi rehan_59764,

When you run mongo --nodb, you are already in the Mongo Shell. If you want to connect to any other mongo cluster like you are trying to do by running this:

> mongo "mongodb://cluster0-shard-00-00-ddsf0.mongodb.net:27017"

You need to run it from outside the mongo shell, the same way you must have done it when you ran “mongo --nodb”.

> quit()
// Press [Enter/Return]

Then you need to write the correct connection string. Steps to do that:

  • Login to Atlas
  • click on Connect button
  • Choose a connection method
  • Connect with the Mongo Shell
  • Choose MongoDB version
  • Copy the string
  • Paste it on your command line

Let me know in case of any confusion and on an unrelatable note, it’s always advisable to use the latest version of MongoDB.



What would be very helpful, is you would show us both the error message and the full command you’re entering. So either copy and paste it here as text, or provide a screenshot like before. Otherwise, we’re sailing blind and cannot help you.

Most importantly, try to understand what you’re actually telling your computer to do with the command(s). Don’t just copy them from the class notes, but understand what each command, flag and parameter means. Otherwise, you will simply keep repeating things “because we did them like that before”, instead of actually learning about MongoDB.

thanks so much , yes i got what i am doing wrong thanks for help