Cannot create a database user in mongosh

When I try to create a user in mongosh I get the following error:

clone(t={}){const r=t.loc||{};return e({loc:new Position("line"in r?r.line:this.loc.line,"column"in r?r.column:...<omitted>...)} could not be cloned.

with the following command:

db.createUser(user: "api_user", pwd: "replacement password",roles: "dbAdmin")

What am I doing wrong?

Hello :wave: @Cezar,

Welcome to the MongoDB Community forums :sparkles:

You are missing the curly braces {} and square brackets [] in the roles section of your command.

db.createUser({user: "api_user", pwd: "replacement password",roles: ["dbAdmin"]})

Please refer to the db.createUser() documentation to learn more.

Let us know if you have any other queries.

Regards,
Kushagra