-
Notifications
You must be signed in to change notification settings - Fork 53
DOCSP-26099: cs is an async iterable #498
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
Conversation
I'm divided on whether to update the example to reflect this change and use a for-await loop in the code snippet, instead of a listener. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one small suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better. A few more small suggestions
TypeScript specific features of the driver relevant to this use case. | ||
|
||
If you run the preceding example, you should see the following output: | ||
When you run this code and then make any changes to the ``haikus`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I: Next clause refers to a single change
S:
When you run this code and then make any changes to the ``haikus`` | |
When you run this code and then make a change to the ``haikus`` |
print change events that occur on the collection. | ||
|
||
First, open the change stream on the collection and then define a listener | ||
on the change stream using the ``on()`` method. Once set, generate a change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I: "Once set" is vague
S: "Once the [whatever] is [whatever], generate a change event..."
To generate the change event on the collection, let's use ``insertOne()`` | ||
method to add a new document. Since the ``insertOne()`` may run before the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To generate the change event on the collection, let's use ``insertOne()`` | |
method to add a new document. Since the ``insertOne()`` may run before the | |
To generate the change event on the collection, let's use the ``insertOne()`` | |
method to add a new document. Since ``insertOne()`` may run before the |
We also use ``simulateAsyncPause`` after the insertion of the document | ||
to provide ample time for the listener function to receive the change | ||
event and for the listener to complete its execution before | ||
closing the ``ChangeStream`` instance using the ``close()`` method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also use ``simulateAsyncPause`` after the insertion of the document | |
to provide ample time for the listener function to receive the change | |
event and for the listener to complete its execution before | |
closing the ``ChangeStream`` instance using the ``close()`` method. | |
We also use ``simulateAsyncPause`` after the insertion of the document. | |
This provides ample time for the listener function to receive the change | |
event and for the listener to complete its execution before | |
closing the ``ChangeStream`` instance using the ``close()`` method. |
The timers used in this example are only necessary for this demonstration | ||
to make sure there is enough time to register listener and have the | ||
listener process the event before exiting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: Put this in a Note admonition to make it stand out
The timers used in this example are only necessary for this demonstration | |
to make sure there is enough time to register listener and have the | |
listener process the event before exiting. | |
.. note:: You don't need timers to use listener functions. | |
The timers in this code example are for demonstration purposes only. |
...or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this creates two stacked notes, but the second note is repetitive from the previous example. I think I should either shift the content out of the note back to normal text, or delete the repetitive note about connecting to MongoDB/sample data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of deleting the redundant note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm + removing redundant note
* DOCSP-26099: change stream async iterable * addtl work * MW PR fixes 1 * small fixes * MW PR fixes 2 * small fixes * remove redundant note (cherry picked from commit 9086828)
* DOCSP-26099: change stream async iterable * addtl work * MW PR fixes 1 * small fixes * MW PR fixes 2 * small fixes * remove redundant note (cherry picked from commit 9086828)
* DOCSP-26099: change stream async iterable * addtl work * MW PR fixes 1 * small fixes * MW PR fixes 2 * small fixes * remove redundant note (cherry picked from commit 9086828)
* DOCSP-26099: change stream async iterable * addtl work * MW PR fixes 1 * small fixes * MW PR fixes 2 * small fixes * remove redundant note (cherry picked from commit 9086828)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-26099
Staging - https://docs-mongodbcom-staging.corp.mongodb.com/node/docsworker-xlarge/DOCSP-26099-cs-iterable/usage-examples/changeStream/
Self-Review Checklist