Definição
endSessionsThe
endSessionscommand 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.Observação
Use o comando
killSessionspara encerrar e remover imediatamente uma sessão.
Compatibilidade
Esse comando está disponível em implantações hospedadas nos seguintes ambientes:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
Observação
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB
MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB
Sintaxe
O comando tem a seguinte sintaxe:
db.runCommand( { endSessions: [ { id : <UUID> }, ... ] } )
To run endSessions, use the db.runCommand( { <command> } ) method.
db.runCommand( { endSessions: [ { id : <UUID> }, ... ] } )
Comportamento
Identificação da sessão
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.
Controle de acesso
If the deployment enforces authentication/authorization, you must be authenticated to run the endSessions command.
Um usuário só pode encerrar sessões que pertencem a ele.