Homework 1.2 - not authorized to create user

I keep getting this error and do not know how to create the admin user that we need.
MongoDB Enterprise TO_BE_SECURED:PRIMARY> db.getSiblingDB("$external").runCommand({createUser: “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”, roles:[{role: ‘root’, db: ‘admin’}]})
{
“ok” : 0,
“errmsg” : “not authorized on $external to execute command { createUser: “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”, roles: [ { role: “root”, db: “admin” } ] }”,
“code” : 13
}

In a previous lab/homework, did you create a root user? If so, login using that user to create another user.

I did. I started this homework from scratch and it worked the second time. Thank you for responding quickly.

1 Like