On this page本页内容
db.
getUsers
(<options>)¶Returns information for all the users in the database.返回数据库中所有用户的信息。
db.getUsers()
wraps the 包装了usersInfo: 1
command.usersInfo: 1
命令。
The db.getUsers()
method can take the following options:db.getUsers()
方法可以采用以下选项:
showCredentials |
boolean | true 以显示用户的密码哈希。false .false 。 |
filter |
document |
|
To view another user’s information, you must have the 要查看其他用户的信息,必须对其他用户的数据库执行viewUser
action on the other user’s database.viewUser
操作。
Users can view their own information.
New in version 4.0:4.0版中新增:The db.getUsers()
method can accept a filter
document to return information for users that match the filter condition.db.getUsers()
方法可以接受filter
文档,以返回与筛选条件匹配的用户的信息。
To view all users for the current database who have 要查看当前数据库中拥有SCRAM-SHA-256
credentials:SCRAM-SHA-256
凭据的所有用户:
When viewing all users, you can specify the 查看所有用户时,可以指定showCredentials
option but not the showPrivileges
or the showAuthenticationRestrictions
options.showCredentials
选项,但不能指定showPrivileges
或showAuthenticationRestrictions
选项。