AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

killSessions(データベースコマンド)

killSessions

The killSessions command kills the specified sessions. If access control is enabled, the command only kills the sessions owned by the user. [1]

このコマンドの構文は、次のとおりです。

db.runCommand(
{
killSessions: [ { id : <UUID> }, ... ]
}
)

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

重要

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

The command takes an array of documents that specify the UUID portion of the session id. Specify an empty array [ ] to kill all sessions, or if access control is enabled, all sessions owned by the user. [1]

既存のセッションを表示するには、 $listSessions操作 または$listLocalSessionsを参照してください。

[1](1, 2) The killSessions operation ignores sessions that have transactions in prepared state. See Behavior for details.

MongoDB concatenates each of the specified UUIDs with the hash of the authenticated user credentials to identify the user's sessions to kill. If the user has no session that match, the killSessions has no effect.

セッションを強制終了すると、セッション内で進行中の操作がすべて終了され、これらの操作に関連付けられている開いているカーソルが閉じられます。

強制終了されたセッションは引き続き現在のセッションとして表示され、今後の操作では強制終了されたセッションが使用される可能性があります。 既存のセッションを表示するには、 $listSessions操作 または$listLocalSessionsを参照してください。

The killSessions operation ignores sessions that have Transactions in prepared state. Transactions in prepared state refer to transactions with write operations that span multiple shards whose commit coordinator has completed the "sendingPrepare" action.

次の操作は、 ユーザーの指定されたセッションを強制終了します。

db.runCommand( { killSessions: [ { id: UUID("f9b3d8d9-9496-4fff-868f-04a6196fc58a") } ] } )