connectionStatus
On this page
Definition
Syntax
The command has the following syntax:
db.runCommand( { connectionStatus: 1, showPrivileges: <boolean> } )
Command Fields
connectionStatus
supports the following optional
field:
Field | Type | Description |
---|---|---|
showPrivileges | boolean | Optional. Set By default, this field is |
Example
To run connectionStatus
use the db.runCommand()
method, as in the following:
db.runCommand( { connectionStatus: 1, showPrivileges: true } )
Output
connectionStatus.authInfo
A document with data about the authentication state of the current connection, including users and available permissions.
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.authenticatedUserRoles[n].db
The database to which
role
applies.
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.