On this page本页内容
db.getUsers(<options>)¶Returns information for all the users in the database.
db.getUsers() wraps the usersInfo: 1 command.
The db.getUsers() method can take the following options:
showCredentials |
boolean | false. |
filter |
document |
|
For more information, see usersInfo.
To view another user’s information, you must have the viewUser action on the other user’s database.
Users can view their own information.
New in version 4.0:The db.getUsers() method can accept a filter document to return information for users that match the filter condition.
To view all users for the current database who have SCRAM-SHA-256 credentials:
When viewing all users, you can specify the showCredentials option but not the showPrivileges or the showAuthenticationRestrictions options.