connectionStatus
¶返回有关当前连接的信息,特别是经过身份验证的用户的状态及其可用权限。
connectionStatus
支持以下可选字段:
领域 | 类型 | 描述 |
---|---|---|
showPrivileges |
布尔值 | 可选的。设置 默认情况下,此字段为 |
要运行connectionStatus
该db.runCommand()
方法,如下所示:
connectionStatus.
authInfo
¶一个文档,其中包含有关当前连接的身份验证状态的数据,包括用户和可用权限。
connectionStatus.authinfo.
authenticatedUsers
¶每个已认证用户的文档数组。
connectionStatus.authInfo.authenticatedUsers[n].
user
¶用户名。
connectionStatus.authInfo.authenticatedUsers[n].
db
¶与用户凭据关联的数据库。
connectionStatus.authinfo.
authenticatedUserRoles
¶一个数组,其中包含授予当前连接的每个角色的文档:
connectionStatus.authinfo.authenticatedUserRoles[n].
role
¶connectionStatus.authInfo.
authenticatedUserPrivileges
¶一个数组,其中包含按资源分组描述授予当前连接的操作的文档。
connectionStatus.authInfo.authenticatedUserPrivileges[n].
resource
¶描述数据库以及适用的集合的文档
connectionStatus.authInfo.authenticatedUserPrivileges[n].actions
。
connectionStatus.authInfo.authenticatedUserPrivileges[n].
actions
¶一个数组,列出了连接可以访问的指定资源的特权操作。
connectionStatus.
ok
¶命令的返回值。值1
表示成功。