@@ -65,20 +65,11 @@ classes:
65
65
- ``Collection``: To monitor changes in the collection
66
66
67
67
The following example opens a change stream on the ``restaurants`` collection
68
- and outputs the changes as they occur. Select the
69
- :guilabel:`Asynchronous` or :guilabel:`Synchronous` tab to see the corresponding
70
- code.
68
+ and outputs the changes as they occur. Select the :guilabel:`Synchronous` or
69
+ :guilabel:`Asynchronous` tab to see the corresponding code.
71
70
72
71
.. tabs::
73
72
74
- .. tab:: Asynchronous
75
- :tabid: change-stream-async
76
-
77
- .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
78
- :start-after: start-open-change-stream-async
79
- :end-before: end-open-change-stream-async
80
- :language: csharp
81
-
82
73
.. tab:: Synchronous
83
74
:tabid: change-stream-sync
84
75
87
78
:end-before: end-open-change-stream
88
79
:language: csharp
89
80
81
+ .. tab:: Asynchronous
82
+ :tabid: change-stream-async
83
+
84
+ .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
85
+ :start-after: start-open-change-stream-async
86
+ :end-before: end-open-change-stream-async
87
+ :language: csharp
88
+
90
89
To begin watching for changes, run the application. Then, in a separate
91
90
application or shell, modify the ``restaurants`` collection. Updating a document
92
91
that has a ``"name"`` value of ``"Blarney Castle"`` results in the following
@@ -134,20 +133,12 @@ You can specify the following aggregation stages in the ``pipeline`` parameter:
134
133
Monitor Update Events Example
135
134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136
135
137
- The following example uses the ``pipeline`` parameter to open a change stream
138
- that records only update operations. Select the :guilabel:`Asynchronous ` or :guilabel:`Synchronous ` tab to see the
139
- corresponding code.
136
+ The following example uses the ``pipeline`` parameter to open a change stream that records
137
+ only update operations. Select the :guilabel:`Synchronous ` or :guilabel:`Asynchronous ` tab
138
+ to see the corresponding code.
140
139
141
140
.. tabs::
142
141
143
- .. tab:: Asynchronous
144
- :tabid: change-stream-async
145
-
146
- .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
147
- :start-after: start-change-stream-pipeline-async
148
- :end-before: end-change-stream-pipeline-async
149
- :language: csharp
150
-
151
142
.. tab:: Synchronous
152
143
:tabid: change-stream-sync
153
144
@@ -156,6 +147,14 @@ corresponding code.
156
147
:end-before: end-change-stream-pipeline
157
148
:language: csharp
158
149
150
+ .. tab:: Asynchronous
151
+ :tabid: change-stream-async
152
+
153
+ .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
154
+ :start-after: start-change-stream-pipeline-async
155
+ :end-before: end-change-stream-pipeline-async
156
+ :language: csharp
157
+
159
158
Split Large Change Events Example
160
159
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161
160
@@ -173,14 +172,6 @@ reassemble any event fragments:
173
172
174
173
.. tabs::
175
174
176
- .. tab:: Asynchronous
177
- :tabid: change-stream-split-async
178
-
179
- .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
180
- :start-after: start-split-change-event-async
181
- :end-before: end-split-change-event-async
182
- :language: csharp
183
-
184
175
.. tab:: Synchronous
185
176
:tabid: change-stream-split-sync
186
177
@@ -189,6 +180,14 @@ reassemble any event fragments:
189
180
:end-before: end-split-change-event-sync
190
181
:language: csharp
191
182
183
+ .. tab:: Asynchronous
184
+ :tabid: change-stream-split-async
185
+
186
+ .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
187
+ :start-after: start-split-change-event-async
188
+ :end-before: end-split-change-event-async
189
+ :language: csharp
190
+
192
191
.. note::
193
192
194
193
We recommend reassembling change event fragments, as shown in the
@@ -202,6 +201,14 @@ The following code defines these methods:
202
201
203
202
.. tabs::
204
203
204
+ .. tab:: Synchronous
205
+ :tabid: split-event-helpers-sync
206
+
207
+ .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
208
+ :start-after: start-split-event-helpers-sync
209
+ :end-before: end-split-event-helpers-sync
210
+ :language: csharp
211
+
205
212
.. tab:: Asynchronous
206
213
:tabid: split-event-helpers-async
207
214
@@ -210,14 +217,6 @@ The following code defines these methods:
210
217
:end-before: end-split-event-helpers-async
211
218
:language: csharp
212
219
213
- .. tab:: Synchronous
214
- :tabid: split-event-helpers-sync
215
-
216
- .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
217
- :start-after: start-split-event-helpers-sync
218
- :end-before: end-split-event-helpers-sync
219
- :language: csharp
220
-
221
220
.. tip::
222
221
223
222
To learn more about splitting large change events, see
@@ -344,19 +343,11 @@ one of the following values:
344
343
345
344
The following example opens a change stream on a collection and includes the post-image
346
345
of updated documents by specifying the ``FullDocument`` option. Select the
347
- :guilabel:`Asynchronous ` or :guilabel:`Synchronous ` tab to see the corresponding
346
+ :guilabel:`Synchronous ` or :guilabel:`Asynchronous ` tab to see the corresponding
348
347
code.
349
348
350
349
.. tabs::
351
350
352
- .. tab:: Asynchronous
353
- :tabid: change-stream-async
354
-
355
- .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
356
- :start-after: start-change-stream-post-image-async
357
- :end-before: end-change-stream-post-image-async
358
- :language: csharp
359
-
360
351
.. tab:: Synchronous
361
352
:tabid: change-stream-sync
362
353
@@ -365,6 +356,14 @@ code.
365
356
:end-before: end-change-stream-post-image
366
357
:language: csharp
367
358
359
+ .. tab:: Asynchronous
360
+ :tabid: change-stream-async
361
+
362
+ .. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
363
+ :start-after: start-change-stream-post-image-async
364
+ :end-before: end-change-stream-post-image-async
365
+ :language: csharp
366
+
368
367
Running the preceding code example and updating a document that has a ``"name"``
369
368
value of ``"Blarney Castle"`` results in the following change stream output:
370
369
0 commit comments