I'm trying to configure certificate based mongo authentication, generally it works fine but there's one question I cannot find answer for. Suppose I created a user in $external database:
use $external
db.createUser({user: "[email protected],CN=jsmith,OU=Mongo Admins,O=Initech,C=US",
roles: [{"role" : "root","db" : "admin"}]
})
Q: How can I query the content of $external database, particularly users data?
Is there any similar way to:
use admin
db.system.users.find()
The "$external" database isn't a real database, and it contains no data. All users and roles data for all databases is stored in admin.system.users
or admin.system.roles
.
The preferred solution is to use the getUsers command.
In the shell, you would issue the following statements:
use $external
db.getUsers()
If you have the right privileges, you can also query admin.system.users
to find the users for any database, as follows:
use admin
db.system.users.find({db: "$external"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With