error in connection mongodb atlas to shell

Viewed 2233

mongo "mongodb+srv://sandbox-hoj54.mongodb.net/test" --authenticationDatabase admin --username m001-student --password m001-mongodb-basics 2020-06-19T14:18:02.553+0530 E QUERY [js] uncaught exception: SyntaxError: unexpected token: string literal : @(shell):1:6

2 Answers

I think the problem is that you are running this command: mongo "mongodb+srv://cluster0-jxrfu.mongodb.net/<dbname>" --username <password> on the MongoDB shell you downloaded in your <your mongo shell's download directory>/bin directory. Instead, Open up a new command line and run the command. It worked for me. mongodb connection via terminal

There are two options to connect to db. Connect with the mongo shell or connect your application. It seems that you are trying to connect by the shell. You can see your connection string in the window:

MongoDB Atlas Panel > Clusters > 'Connect' button.

Of course you have to replace <dbname> and <password> as in the description.

MongoDB Cloud

Related