MongoDB Shell SyntaxError: unexpected token: string literal

Yes, the MongoDB Enterprise > is the Mongo Shell prompt. So, as @Doug_Duncan mentioned you have to enter the connection string (e.g., mongo mongodb+srv://m999student:m999password@abc-xyz123.mongodb.net/testdb) from the operating system command prompt.

The Mongo Shell utility program allows you connect to the MongoDB database server using a connection string, e.g., just typing mongo from OS command prompt will connect to the MongoDB server at the default localhost at port 27017. In the screen shot @Lillie_Sauer had posted, is already connected to the server perhaps using the default host and port.

Actually, from the Mongo Shell prompt, the commands are show dbs (prints all the database names on the MongoDB server) and show collections (prints all the collection names in the current database).

1 Like