ryansin
ryansin

Reputation: 1817

Syntax Error: missing ) after argument list @(shell):2:4

I am getting the above error in Mongo DB when entering the following in the shell but I can't for the life of me see where there is a syntax error...

db.createUser (
... "user":"dbTest",
... "pwd":"testPass",
... "roles": [
... { "role":"readWrite", "db":"test" }
... ]
... )

That has been copied and pasted directly from the console.

Upvotes: 9

Views: 10083

Answers (1)

Kobi
Kobi

Reputation: 138107

You're missing curly braces around the object literal:

db.createUser ({
    "user":"dbTest",
    "pwd":"testPass",
    "roles": [
    { "role":"readWrite", "db":"test" }
    ]
    })

See db.createUser() - Examples

Upvotes: 5

Related Questions