endSessions

Definition

  • endSessions

New in version 3.6.

The endSessions command expires the specified sessions.The command overrides the timeout period that sessions wait beforeexpiring.

endSessions has the following syntax:

  1. { endSessions: [ { id : <UUID> }, ... ] } )

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

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

Behavior

Session Identification

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

Access Control

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

A user can only end sessions belonging to the user.

See also