Docs Menu
Docs Home
/
MongoDB Manual
/ / /

endSessions

On this page

  • Definition
  • Syntax
  • Behavior
  • Access Control
endSessions

The endSessions command marks a session as expired to signal to the server to clean up the session and updates the expiration time of the session. The command overrides the timeout period that sessions wait before expiring.

Note

Use the killSessions command to immediately terminate and remove a session.

The command has the following syntax:

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

To run endSessions, use the db.runCommand( { <command> } ) method.

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

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

If the deployment enforces authentication/authorization, you must be authenticated to run the endSessions command.

A user can only end sessions belonging to the user.

Tip

See also:

Back

commitTransaction