How to list all users in the mongo shell?

naXa picture naXa · Sep 15, 2015 · Viewed 98.4k times · Source

In the MongoDB shell, how do I list all users for the current database that I'm using?
I can't seem to find it anywhere on stackoverflow.

Answer

naXa picture naXa · Sep 15, 2015

You can do:

db.getUsers()

or

show users

The both commands print a list of users for the current database. See MongoDB documentation for User Management.