Skip to content

[v6.14] DOCSP-51959 Add a warning about tryNext bug to all change stream manual iteration examples (#1189) #1194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
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
6 changes: 6 additions & 0 deletions source/includes/try-next-warning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. warning::

The `tryNext() <{+api+}/classes/ChangeStream.html#tryNext>`_ method does not
automatically update the change stream's `resumeToken.
<{+api+}/classes/ChangeStream.html#resumeToken>`_ If you require an updated
``resumeToken``, use the ``next()`` method.
5 changes: 4 additions & 1 deletion source/monitoring-and-logging/change-streams.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ section for more information on the settings you can configure with this object.
The ``watch()`` method returns an instance of a `ChangeStream <{+api+}/classes/ChangeStream.html>`__. You can read events from
change streams by iterating over them or listening for events.

.. include:: /includes/changestream-paradigm-warning.rst

Select the tab that corresponds to the way you want to
read events from the change stream:

Expand Down Expand Up @@ -72,6 +74,7 @@ read events from the change stream:
- ``next()`` to request the next document in the stream
- ``close()`` to close the ChangeStream

.. include:: /includes/try-next-warning.rst

.. tab::
:tabid: Event
Expand All @@ -98,7 +101,7 @@ read events from the change stream:

changeStream.close();

.. include:: /includes/changestream-paradigm-warning.rst
.. _node-usage-watch:

Examples
--------
Expand Down
Loading