1

I am following this tutorial

https://docs.nodebb.org/installing/os/windows/

I got thru most of it easily but when I go to login as an admin with this command:

mongo -u admin -p ojo --authenticationDatabase=admin

I get an error:

uncaught exception: SyntaxError: unexpected token: identifier :
@(shell):1:9

ojo is the password btw

the admin account was created and it shows up when you run show users

show users
{
        "_id" : "admin.admin",
        "userId" : UUID("e3c3df1d-f63d-48e3-ae65-b9cf03c86333"),
        "user" : "admin",
        "db" : "admin",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ],
        "mechanisms" : [
                "SCRAM-SHA-1",
                "SCRAM-SHA-256"
        ]
}
{
        "_id" : "admin.admin2",
        "userId" : UUID("0b87390b-2c08-4e21-9183-8a2406a9304e"),
        "user" : "admin2",
        "db" : "admin",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ],
        "mechanisms" : [
                "SCRAM-SHA-1",
                "SCRAM-SHA-256"
        ]
}

What am I doing incorrectly? Tried many attempts.

Elizabeth
  • 21
  • 1
  • 1
  • 3
  • What is the complete output of the command? – D. SM Sep 12 '20 at 17:22
  • > mongo -u admin -p ojo --authenticationDatabase=admin uncaught exception: SyntaxError: unexpected token: identifier : @(shell):1:9 – Elizabeth Sep 12 '20 at 20:10
  • @D.SM that is al – Elizabeth Sep 12 '20 at 20:10
  • 1
    Take a look at [mongoexport E QUERY SyntaxError: Unexpected identifier](https://stackoverflow.com/questions/29431351/mongoexport-e-query-syntaxerror-unexpected-identifier) - that error usually indicates you are already connected to the mongo shell. That command should be run from the operating system command line. – Joe Sep 14 '20 at 01:56

1 Answers1

2

Don't open mongo shell and enter the connection string.

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

  1. Press win + r
  2. Type cmd
  3. Paste the connection string
  4. now you'll be prompted to enter password, enter it and that's all!
Example person
  • 3,198
  • 3
  • 18
  • 45