[SOLVED] HW 1.5 $external won't accept userAdminAnyDatabase role?

db.getSiblingDB("$external").runCommand({createUser:"C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client", roles:[{role:"userAdminAnyDatabase ", db:"admin"}]})
        "ok" : 0,
        "errmsg" : "No role named userAdminAnyDatabase @admin",
        "code" : 31

It accept other roles, like “root”, but I suppose that validation will fail then.


What specific Lab or Quiz are you trying to do? And if you have set up a ‘root’ user, can you login as that user? If you can give me some more information, I’ll try to help.

Sorry for being short, it was late and I just needed to offload my brain :slight_smile:

Homework 1.5: Enabling Mixed Authentication Mechanisms

A task is to create a three-member replica set that uses X.509 certificates and SCRAM-SHA-1 for client authentication.

So I set up an RS with needed authentication mechanisms and created a SCRAM-SHA-1 user named “will” with a password of “$uperAdmin” with the root role on the admin database. Also authenticated with him. So far so good.

Problem arose with creating X.509 user. He needs role "userAdminAnyDatabase " on admin database. But when I tried creating him, error was thrown.


I accidentally put whitespace after "userAdminAnyDatabase ".

Problem solved.