Skip to content

Commit ad0b33f

Browse files
authored
DOCSP-51959 Add a warning about tryNext bug to all change stream manual iteration examples (#1189) (#1200)
* DOCSP-51959 tryNext resumeToken error warning * fix link * bracket removal * move warning (cherry picked from commit 7baddf7)
1 parent 9416d7c commit ad0b33f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

source/includes/try-next-warning.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. warning::
2+
3+
The `tryNext() <{+api+}/classes/ChangeStream.html#tryNext>`_ method does not
4+
automatically update the change stream's `resumeToken.
5+
<{+api+}/classes/ChangeStream.html#resumeToken>`_ If you require an updated
6+
``resumeToken``, use the ``next()`` method.

source/monitoring-and-logging/change-streams.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ section for more information on the settings you can configure with this object.
4444
The ``watch()`` method returns an instance of a `ChangeStream <{+api+}/classes/ChangeStream.html>`__. You can read events from
4545
change streams by iterating over them or listening for events.
4646

47+
.. include:: /includes/changestream-paradigm-warning.rst
48+
4749
Select the tab that corresponds to the way you want to
4850
read events from the change stream:
4951

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

77+
.. include:: /includes/try-next-warning.rst
7578

7679
.. tab::
7780
:tabid: Event
@@ -98,7 +101,7 @@ read events from the change stream:
98101

99102
changeStream.close();
100103

101-
.. include:: /includes/changestream-paradigm-warning.rst
104+
.. _node-usage-watch:
102105

103106
Examples
104107
--------

0 commit comments

Comments
 (0)