diff --git a/source/fundamentals/crud/read-operations/change-streams.txt b/source/fundamentals/crud/read-operations/change-streams.txt index b7820293..d30f55a2 100644 --- a/source/fundamentals/crud/read-operations/change-streams.txt +++ b/source/fundamentals/crud/read-operations/change-streams.txt @@ -193,7 +193,7 @@ reassemble any event fragments: We recommend reassembling change event fragments, as shown in the preceding example, but this step is optional. You can use the same - logic to watch split events and complete change events. + logic to watch both split and complete change events. The preceding example uses the ``GetNextChangeStreamEvent()``, ``GetNextChangeStreamEventAsync()``, and ``MergeFragment()`` diff --git a/source/includes/code-examples/change-streams/change-streams.cs b/source/includes/code-examples/change-streams/change-streams.cs index 4fc7f1f7..ff0bb4a0 100644 --- a/source/includes/code-examples/change-streams/change-streams.cs +++ b/source/includes/code-examples/change-streams/change-streams.cs @@ -67,25 +67,25 @@ await cursor.ForEachAsync(change => // start-split-event-helpers-sync // Fetches the next complete change stream event - private static IEnumerable> GetNextChangeStreamEvent( - IEnumerator> changeStreamEnumerator) - { - while (changeStreamEnumerator.MoveNext()) - { - var changeStreamEvent = changeStreamEnumerator.Current; - if (changeStreamEvent.SplitEvent != null) - { - var fragment = changeStreamEvent; - while (fragment.SplitEvent.Fragment < fragment.SplitEvent.Of) - { - changeStreamEnumerator.MoveNext(); - fragment = changeStreamEnumerator.Current; - MergeFragment(changeStreamEvent, fragment); - } - } - yield return changeStreamEvent; - } - } +private static IEnumerable> GetNextChangeStreamEvent( +IEnumerator> changeStreamEnumerator) +{ + while (changeStreamEnumerator.MoveNext()) + { + var changeStreamEvent = changeStreamEnumerator.Current; + if (changeStreamEvent.SplitEvent != null) + { + var fragment = changeStreamEvent; + while (fragment.SplitEvent.Fragment < fragment.SplitEvent.Of) + { + changeStreamEnumerator.MoveNext(); + fragment = changeStreamEnumerator.Current; + MergeFragment(changeStreamEvent, fragment); + } + } + yield return changeStreamEvent; + } +} // Merges a fragment into the base event private static void MergeFragment(