-
Notifications
You must be signed in to change notification settings - Fork 43
DOCSP-31907 Split Event #457
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
Changes from 4 commits
f7baab0
1a0e70c
6192acc
89bdd3c
9ec21b0
f52a0b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -288,3 +288,56 @@ output: | |||||||
|
||||||||
For a list of options, see the `FullDocument <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/changestream/FullDocument.html>`__ | ||||||||
API documentation. | ||||||||
|
||||||||
Split Large Change Stream Events | ||||||||
-------------------------------- | ||||||||
|
||||||||
Starting in MongoDB 7.0, you can use a ``$changeStreamSplitLargeEvent`` | ||||||||
aggregation stage to split events that exceed 16 MB into smaller fragments. | ||||||||
``$changeStreamSplitLargeEvent`` returns the fragments sequentially using the | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestions:
E.g. |
||||||||
change stream cursor. Each fragment includes a ``SplitEvent`` object containing | ||||||||
the following fields: | ||||||||
|
||||||||
.. list-table:: | ||||||||
:header-rows: 1 | ||||||||
:widths: 35 65 | ||||||||
|
||||||||
* - Field | ||||||||
- Description | ||||||||
|
||||||||
* - ``fragment`` | ||||||||
- The index of the fragment, starting at 1 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: |
||||||||
|
||||||||
* - ``of`` | ||||||||
- The total number of fragments in the event | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Partially because Vale picked this up, but since "in the event" could be interpreted as an idiom, I think it could be good to reword it, and provide additional detail. E.g. "The total number of fragments that compose the split change event |
||||||||
|
||||||||
Enable the ``$changeStreamSplitLargeEvent`` aggregation on your change stream as | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: I think "enable the ... aggregation" might not be an accurate term to describe setting up the change stream. I think the "modify change stream output" or "control change stream output" could work better as described in the Server manual docs E.g. |
||||||||
shown in the following example: | ||||||||
|
||||||||
.. code-block:: java | ||||||||
|
||||||||
ChangeStreamIterable<Document> changeStream = collection.watch( | ||||||||
Arrays.asList(Document.parse("{ $changeStreamSplitLargeEvent: {} }"))); | ||||||||
|
||||||||
.. note:: | ||||||||
|
||||||||
You can have only one ``$changeStreamSplitLargeEvent`` stage in your | ||||||||
aggregation pipeline, and it must be the last stage in the pipeline. | ||||||||
|
||||||||
You can access the ``SplitEvent`` by using your change stream cursor with the | ||||||||
``getSplitEvent()`` as follows: | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion:
Suggested change
|
||||||||
|
||||||||
.. code-block:: java | ||||||||
|
||||||||
MongoChangeStreamCursor<ChangeStreamDocument<Document>> cursor = changeStream.cursor(); | ||||||||
|
||||||||
// Application code that creates change stream events | ||||||||
// ... | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: I think these lines aren't relevant to the example and should be omitted. The other lines demonstrate the objective, and it's not required for the reader to use the same app that watches for change events to also generate them. |
||||||||
|
||||||||
SplitEvent event = cursor.tryNext().getSplitEvent(); | ||||||||
|
||||||||
For more information about accessing data from a cursor, see :ref:`java-fundamentals-cursor`. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: I think it might be useful to either qualify this information, given that it doesn't include specific information on change stream cursors, or omit it. To qualify the information, first it would be helpful to check what similarities the two different types of cursors have and then to include that. Hypothetically, if MongoChangeStreamCursor extended MongoCursor, I would suggest something like the following: The MongoChangeStreamCursor extends MongoCursor and shares the same methods to access data. To learn how to access data from a MongoCursor, see ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed this line since it's a ChangeStreamCursor not a MongoCursor |
||||||||
|
||||||||
For more information on the ``$changeStreamSplitLargeEvent`` aggregation stage, | ||||||||
see the :manual:`$changeStreamSplitLargeEvent | ||||||||
</reference/operator/aggregation/changeStreamSplitLargeEvent/>` server documentation. |
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.
Suggestion:
Use the specific article "the" since only one of them exists.