Search code examples
mongodbcommandmongo-shell

How to list all users in the mongo shell?


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.


Solution

  • 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.