定義
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.runCommand( { connectionStatus: 1, showPrivileges: <boolean> } )
コマンドフィールド
connectionStatus 次のオプション フィールドをサポートします。
フィールド | タイプ | 説明 |
|---|---|---|
| ブール値 | Optional. Set デフォルトでは、このフィールドは |
例
To run connectionStatus use the db.runCommand() method, as in the following:
db.runCommand( { connectionStatus: 1, showPrivileges: true } )
出力
connectionStatus.authinfo.authenticatedUserRoles現在の接続に付与されている各ロールのドキュメントを含む配列:
connectionStatus.authinfo.authenticatedUserRoles[n].role現在認証されているユーザーに関連付けられている現在のロールの定義。詳しくは、「組み込みロール」および「権限アクション」を参照してください。
connectionStatus.authinfo.authenticatedUserRoles[n].dbThe database to which
roleapplies.
connectionStatus.authInfo.authenticatedUserPrivileges現在の接続に許可されているアクションを説明するドキュメントの配列。リソースごとにグループ化されています。
connectionStatus.authInfo.authenticatedUserPrivileges[n].resourceA document describing the database and, if applicable, collection to which
connectionStatus.authInfo.authenticatedUserPrivileges[n].actionsapplies.