Database Manual / Reference / Database Commands / Sessions

refreshSessions (database command)

Definition

refreshSessions

The refreshSessions command updates the last use time for the specified sessions, thereby extending the active state of the sessions.

Compatibility

This command is available in deployments hosted in the following environments:

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

Note

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

Syntax

The command has the following syntax:

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

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

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

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 refresh. If the user has no session that match, the refreshSessions has no effect.

Access Control

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

A user can only refresh sessions belonging to the user.