Syntax Error: "Missing semicolon"

Im new to MongoDB. Just installed Mongo through hombrew successfully. When I try to run the most basic commands such as “mongosh – version” or “mongo help” I get hit with a “Missing Semicolon” syntax error.

Im not sure what Im doing wrong.

Also, Im getting a reference error: “mongosh not defined” when running “mongosh -help”

1 Like

Most likely you are at mongo prompt
Exit and run your command from os prompt

1 Like

So all “mongosh” commands I should be running from os prompt? And do i need to get out of the mongosh shell altogether?

Hi @Ariel_Nurieli,

Not all mongosh command needs to be executed from the OS prompt. The options of the mongosh can be executed from the OS prompt. You can see all the options after running mongosh --help.

To see all the mongosh options refer to this link: https://www.mongodb.com/docs/mongodb-shell/reference/options/#options

And for all the methods of mongosh: https://www.mongodb.com/docs/mongodb-shell/reference/methods/

I hope it helps! Please let us know if you have any further questions

Thanks,
Kushagra

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.