@@ -24,6 +24,7 @@ Change Stream Examples
24
24
25
25
26
26
27
+
27
28
.. contents:: On this page
28
29
:local:
29
30
:backlinks: none
@@ -47,6 +48,12 @@ Change Stream Examples
47
48
<http://mongodb.github.io/mongo-java-driver/3.6/driver/tutorials/databases-collections/>`_
48
49
that contains an ``inventory`` collection.
49
50
51
+ - id: csharp
52
+ content: |
53
+ The examples below assume that you have `connected to a MongoDB replica set and have accessed a database
54
+ <http://mongodb.github.io/mongo-csharp-driver/2.4/getting_started/quick_tour/#make-a-connection/>`_
55
+ that contains an ``inventory`` collection.
56
+
50
57
- id: c
51
58
content: |
52
59
The examples below assume that you have `connected to a MongoDB replica set and have accessed a database
@@ -85,6 +92,15 @@ as long as a connection to the MongoDB deployment remains open *and* the collect
85
92
:dedent: 8
86
93
:start-after: Start Changestream Example 1
87
94
:end-before: End Changestream Example 1
95
+
96
+ - id: csharp
97
+ content: |
98
+ .. class:: copyable-code
99
+ .. literalinclude:: /driver-examples/ChangeStreamExamples.cs
100
+ :language: c#
101
+ :dedent: 12
102
+ :start-after: Start Changestream Example 1
103
+ :end-before: End Changestream Example 1
88
104
89
105
- id: c
90
106
content: |
@@ -131,6 +147,13 @@ Lookup Full Document for Update Operations
131
147
To return the most current majority-committed version of the updated
132
148
document, pass the ``"fullDocument"`` option with the ``"updateLookup"`` value to the
133
149
:method:`mongoc_collection_watch` method.
150
+
151
+ - id: csharp
152
+ content: |
153
+ By default, change streams only return the delta of fields during the update operation.
154
+ To return the most current majority-committed version of the updated
155
+ document, pass ``"FullDocument = ChangeStreamFullDocumentOption.UpdateLookup"`` to the
156
+ :method:`collection.Watch()` method.
134
157
135
158
136
159
If there are one or more majority-committed operations that modified the
@@ -170,6 +193,16 @@ update operation.
170
193
:dedent: 8
171
194
:start-after: Start Changestream Example 2
172
195
:end-before: End Changestream Example 2
196
+
197
+ - id: csharp
198
+ content: |
199
+ .. class:: copyable-code
200
+
201
+ .. literalinclude:: /driver-examples/ChangeStreamExamples.cs
202
+ :language: C#
203
+ :dedent: 12
204
+ :start-after: Start Changestream Example 2
205
+ :end-before: End Changestream Example 2
173
206
174
207
- id: c
175
208
content: |
@@ -281,6 +314,22 @@ notification after a specific notification.
281
314
:dedent: 8
282
315
:start-after: Start Changestream Example 3
283
316
:end-before: End Changestream Example 3
317
+
318
+ - id: csharp
319
+ content: |
320
+ In the example below, the ``resumeToken`` is retrieved from the last change stream document
321
+ and passed to the ``Watch()`` method as an option. Passing the ``resumeToken``
322
+ to the ``Watch()`` method directs
323
+ the change stream to attempt to resume notifications starting at the
324
+ operation specified in the resume token.
325
+
326
+ .. class:: copyable-code
327
+
328
+ .. literalinclude:: /driver-examples/ChangeStreamExamples.cs
329
+ :language: C#
330
+ :dedent: 12
331
+ :start-after: Start Changestream Example 3
332
+ :end-before: End Changestream Example 3
284
333
285
334
- id: c
286
335
content: |
0 commit comments