Clean up the session after work completes.

Section: Transactions

End a session

javascript
javascript
session.endSession()
Explanation

A good habit after session-based work.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Transactions
Start a session
Create a session for transactional work.
OpenIn sheetjavascriptsame section
Start a transaction
Begin a multi-document transaction.
OpenIn sheetjavascriptsame section
Transaction example
Insert and update as one transaction.
OpenIn sheetjavascriptsame section
Abort a transaction
Roll back a started transaction.
OpenIn sheetjavascriptsame section
Watch a collection
Open a change stream on one collection.
OpenIn sheetjavascript1 tag match
Watch only selected changes
Filter stream events with a pipeline.
OpenIn sheetjavascript1 tag match