Skip to content

Commit 5764b75

Browse files
committed
FP feedback
1 parent db64098 commit 5764b75

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

source/fundamentals/crud/read-operations/change-streams.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -162,53 +162,55 @@ Split Large Change Events Example
162162
If your application generates change events that exceed 16 MB in size, the
163163
server returns a ``BSONObjectTooLarge`` error. To avoid this error, you can use
164164
the ``$changeStreamSplitLargeEvent`` pipeline stage to split the events
165-
into smaller fragments.
165+
into smaller fragments. The {+driver-short+} aggregation API includes the
166+
``ChangeStreamSplitLargeEvent()`` method, which you can use to add the
167+
``$changeStreamSplitLargeEvent`` stage to the change stream pipeline.
166168

167-
After you receive the change stream event fragments, you can use the
168-
following helper methods to reassemble the fragments into a single
169-
change stream document:
169+
This example instructs the driver to watch for changes and split
170+
change events that exceed the 16 MB limit. The code prints the
171+
change document for each event and calls helper methods to
172+
reassemble any event fragments:
170173

171174
.. tabs::
172175

173176
.. tab:: Asynchronous
174-
:tabid: split-event-helpers-async
177+
:tabid: change-stream-split-async
175178

176179
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
177-
:start-after: start-split-event-helpers-async
178-
:end-before: end-split-event-helpers-async
180+
:start-after: start-split-change-event-async
181+
:end-before: end-split-change-event-async
179182
:language: csharp
180183

181184
.. tab:: Synchronous
182-
:tabid: split-event-helpers-sync
185+
:tabid: change-stream-split-sync
183186

184187
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
185-
:start-after: start-split-event-helpers-sync
186-
:end-before: end-split-event-helpers-sync
188+
:start-after: start-split-change-event-sync
189+
:end-before: end-split-change-event-sync
187190
:language: csharp
188191

189-
This example instructs the driver to watch for changes and split
190-
change events that exceed the 16 MB limit. The code prints the
191-
change document for each event and calls the preceding helper methods to
192-
reassemble any event fragments:
192+
The preceding example uses the ``GetNextChangeStreamEvent()`` and ``MergeFragment()``
193+
methods to reassemble change event fragments into a single change stream document.
194+
The following code defines these methods:
193195

194196
.. tabs::
195197

196198
.. tab:: Asynchronous
197-
:tabid: change-stream-split-async
199+
:tabid: split-event-helpers-async
198200

199201
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
200-
:start-after: start-split-change-event-async
201-
:end-before: end-split-change-event-async
202+
:start-after: start-split-event-helpers-async
203+
:end-before: end-split-event-helpers-async
202204
:language: csharp
203205

204206
.. tab:: Synchronous
205-
:tabid: change-stream-split-sync
207+
:tabid: split-event-helpers-sync
206208

207209
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
208-
:start-after: start-split-change-event-sync
209-
:end-before: end-split-change-event-sync
210+
:start-after: start-split-event-helpers-sync
211+
:end-before: end-split-event-helpers-sync
210212
:language: csharp
211-
213+
212214
.. tip::
213215

214216
To learn more about splitting large change events, see

source/includes/code-examples/change-streams/change-streams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private static void MergeFragment<TDocument>(
103103

104104
// start-split-event-helpers-async
105105
// Fetches the next complete change stream event
106-
private static async Task<ChangeStreamDocument<TDocument>> GetNextChangeStreamEventAsync<TDocument>(
106+
private static async Task<ChangeStreamDocument<TDocument>> GetNextChangeStreamEvent<TDocument>(
107107
IAsyncCursor<ChangeStreamDocument<TDocument>> changeStreamCursor)
108108
{
109109
var changeStreamEvent = changeStreamCursor.Current.First();
@@ -150,7 +150,7 @@ private static void MergeFragment<TDocument>(
150150
{
151151
foreach (var changeStreamEvent in cursor.Current)
152152
{
153-
var completeEvent = await GetNextChangeStreamEventAsync(cursor);
153+
var completeEvent = await GetNextChangeStreamEvent(cursor);
154154
Console.WriteLine("Received the following change: " + completeEvent.BackingDocument);
155155
}
156156
}

0 commit comments

Comments
 (0)