Perhaps somebody can answer this better, but one reason for {} there could be a JSON or object literal, but even then, I think it should be more like {abc:def, efg:hij, jkl:mln} (for an object literal - where def,hij e.t.c. are variable names for strings, or string literals) or this for a JSON {"abc":"def", "efg":"hij", "jkl":"mln"}
The mongo documentation for create user https://docs.mongodb.org/v3.0/reference/method/db.createUser/ gives somewhat of an example. Note the property:value pairs separated by commas
use admin
db.createUser(
{
user: "appAdmin",
pwd: "password",
roles:
[
{ role: "readWrite", db: "config" },
"clusterAdmin"
]
}
)
or here, from the same link, but with examples of JSONs and examples of object literals. Note the value pairs, for object literals, and the value pairs for JSONs.
use products
db.createUser( { "user" : "accountAdmin01",
"pwd": "cleartext password",
"customData" : { employeeId: 12345 },
"roles" : [ { role: "clusterAdmin", db: "admin" },
{ role: "readAnyDatabase", db: "admin" },
"readWrite"
] },
{ w: "majority" , wtimeout: 5000 } )
EDIT
Dmytro Shevchenko in my discussion with him, made the important point, that in the formal parameters of a function definition i.e. function abc(....) {}
in the ... you would never have a JSON or object literal or any { }. You may pass in an object literal or JSON or function with body, so what you pass in might have { } so they may get passed in as arguments(actual parameters) to a function. But never they'd never be formal parameters. So the code you mention, is wrong on multiple levels.. {abc,def} is invalid as an object literal, invalid as a JSON, and invalid in that even if it was adapted to being a valid object literal or valid JSON, it shouldn't be there!
Here was the chat with Dmytro https://chat.stackoverflow.com/rooms/95661/discussion-between-barlop-and-dmytro-shevchenko