Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mongodb

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.

like image 448
ryansin Avatar asked Jan 05 '17 12:01

ryansin


1 Answers

You're missing curly braces around the object literal:

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

See db.createUser() - Examples

like image 59
Kobi Avatar answered Oct 24 '22 06:10

Kobi