How to list all users in the mongo shell?

1.5K    Asked by Amitjaisawal in Tableau , Asked on Jul 18, 2021

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. Don’t know how MongoDB list users?

Answered by Danna sahi

To list all users in the mongo shell you can use the getUsers() method or show command.

Case 1 − Using getUsers() The syntax is as follows − db.getUsers();
db.getUsers()
Case 2 − Using show command. The syntax is as follows − ...
show users
Both commands print a list of users for the current database. See MongoDB documentation for User Management.

Your Answer

Interviews

Parent Categories