From f2b32ac2415fb6a4ed20c8639a6d2a46402eeb3c Mon Sep 17 00:00:00 2001 From: alisonjhuh Date: Mon, 2 Aug 2021 10:27:53 -0400 Subject: [PATCH] DOCS-13976 update cursor timeout conditions to reflect behavior when belonging to a server session --- source/reference/glossary.txt | 8 +++++--- source/release-notes/5.0.txt | 10 ++++++++++ source/tutorial/iterate-a-cursor.txt | 26 ++++++++++++++++++++------ 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/source/reference/glossary.txt b/source/reference/glossary.txt index 34902fa7438..2ecec61ac1f 100644 --- a/source/reference/glossary.txt +++ b/source/reference/glossary.txt @@ -208,9 +208,11 @@ Glossary cursor A pointer to the result set of a :term:`query`. Clients can - iterate through a cursor to retrieve results. By default, cursors - timeout after 10 minutes of inactivity. See - :ref:`read-operations-cursors`. + iterate through a cursor to retrieve results. By default, cursors + not opened within a session automatically timeout after 10 + minutes of inactivity. Cursors opened under a session close with + the end or timeout of the session. + See :ref:`read-operations-cursors`. daemon The conventional name for a background, non-interactive diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt index f510b3a6201..c1b264d6448 100644 --- a/source/release-notes/5.0.txt +++ b/source/release-notes/5.0.txt @@ -789,6 +789,16 @@ collections is lower than 0.5 GB. When the cumulative size of the The estimated size in bytes of a ``plan cache`` entry is available in the output of :pipeline:`$planCacheStats`. +Closure of Inactive Cursors Opened Within a Session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 5.0 (and 4.4.8), cursors created within a +:doc:`client session ` close +when the corresponding :doc:`server session ` +ends with the :dbcommand:`killSessions` command, if the session times +out, or if the client has exhausted the cursor. +See :ref:`read-operations-cursors`. + .. _5.0-rel-notes-platforms: Platform Support diff --git a/source/tutorial/iterate-a-cursor.txt b/source/tutorial/iterate-a-cursor.txt index 2bc0c7a9d98..854af9d0184 100644 --- a/source/tutorial/iterate-a-cursor.txt +++ b/source/tutorial/iterate-a-cursor.txt @@ -118,13 +118,26 @@ The ``myCursor[1]`` is equivalent to the following example: Cursor Behaviors ---------------- -Closure of Inactive Cursors -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Cursors Opened Within a Session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -By default, the server will automatically close the cursor after 10 -minutes of inactivity, or if client has exhausted the cursor. To -override this behavior in :binary:`~bin.mongosh`, you can use -the :method:`cursor.noCursorTimeout()` method: +Starting in MongoDB 5.0 (and 4.4.8), cursors created within a +:doc:`client session ` close +when the corresponding :doc:`server session ` +ends with the :dbcommand:`killSessions` command, if the session times +out, or if the client has exhausted the cursor. + +By default, server sessions have an expiration timeout of 30 minutes. To +change the value, set the :parameter:`localLogicalSessionTimeoutMinutes` +parameter when starting up :binary:`~bin.mongod`. + +Cursors Opened Outside of a Session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Cursors that aren't opened under a session automatically close after 10 +minutes of inactivity, or if client has exhausted the cursor. To +override this behavior in :binary:`~bin.mongosh`, you can use the +:method:`cursor.noCursorTimeout()` method: .. code-block:: javascript @@ -135,6 +148,7 @@ manually with :method:`cursor.close()` or by exhausting the cursor's results. See your :driver:`driver ` documentation for information on setting the ``noCursorTimeout`` option. + .. _cursor-isolation: