Mongo Shell issues

Which ever command I type in Mongo Shell it gives me this error

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

When I open MongoDB shell it shows this

MongoDB shell version v4.0.5

connecting to: mongodb://
Implicit session: session { “id” : UUID(“401e223d-0a1e-4838-aaf7-c1e8e9246ae5”) }
MongoDB server version: 4.0.5
Server has startup warnings:
2019-01-15T21:49:12.245-0800 I CONTROL [initandlisten]
2019-01-15T21:49:12.245-0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-01-15T21:49:12.245-0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-01-15T21:49:12.245-0800 I CONTROL [initandlisten]

Does anyone has the same problem?

Can you given an example of a command you’re trying to run on Mongo Shell?

I did get the semicolon error myself but that was because I wasn’t using quotations in the key part of query. Maybe you have the same issue.

For starters try running show dbs and show collections to see if they work.

When I try to connect to my own cluster.

Please share the command you are using and make sure you are not in the mongo shell already.


HI, I guess, You have to give permission for the dbpath --dbpath /data/db, Please give read and write access to the storage location and try again.