On this page本页内容
connectionStatus Returns information about the current connection, specifically the state of authenticated users and their available permissions.返回有关当前连接的信息,特别是已验证用户的状态及其可用权限。
{ connectionStatus: 1, showPrivileges: <boolean> }
connectionStatus supports the following optional field:支持以下可选字段:
showPrivileges | boolean |
|
To run 要运行connectionStatus use the db.runCommand() method, as in the following:connectionStatus,请使用db.runCommand()方法,如下所示:
db.runCommand( { connectionStatus: 1, showPrivileges: true } )
connectionStatus.authInfo A document with data about the authentication state of the current connection, including users and available permissions.包含有关当前连接的身份验证状态(包括用户和可用权限)的数据的文档。
connectionStatus.authinfo.authenticatedUsers An array with documents for each authenticated user.包含每个已验证用户的文档的数组。
connectionStatus.authinfo.authenticatedUserRoles An array with documents for each role granted to the current connection:一个数组,其中包含授予当前连接的每个角色的文档:
connectionStatus.authinfo.authenticatedUserRoles[n].role The definition of the current roles associated with the current authenticated users. 与当前已验证用户关联的当前角色的定义。See Built-In Roles and Privilege Actions for more information.有关详细信息,请参阅内置角色和权限操作。
connectionStatus.authInfo.authenticatedUserPrivileges An array with documents describing the actions granted to the current connection, grouped by resource.一个数组,其中包含描述授予当前连接的操作的文档,按资源分组。
connectionStatus.authInfo.authenticatedUserPrivileges[n].resource A document describing the database and, if applicable, collection to which 描述数据库以及connectionStatus.authInfo.authenticatedUserPrivileges[n].actions applies.connectionStatus.authInfo.authenticatedUserPrivileges[n].actions所应用的集合(如果适用)的文档。