On this page
killSessions
On this page
Definition
killSessions
-
New in version 3.6.
The
killSessions
command kills the specified sessions. If access control is enabled, the command only kills the sessions owned by the user.Note
Killing a session also kills any in-progress operations in the session and closes any open cursors associated with these operations.
Syntax
The command has the following syntax:
db.runCommand( { killSessions: [ { id : <UUID> }, ... ] } )
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.
To view existing sessions, see $listSessions
operation or $listLocalSessions
.
Behavior
Session Identification
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.