Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions source/reference/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions source/release-notes/5.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 </core/read-isolation-consistency-recency>` close
when the corresponding :doc:`server session </reference/server-sessions>`
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
Expand Down
26 changes: 20 additions & 6 deletions source/tutorial/iterate-a-cursor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 </core/read-isolation-consistency-recency>` close
when the corresponding :doc:`server session </reference/server-sessions>`
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

Expand All @@ -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:

Expand Down