@@ -68,6 +68,13 @@ Change Stream Examples
68
68
<https://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html#connect>`__
69
69
that contains an ``inventory`` collection.
70
70
71
+
72
+ - id: php
73
+ content: |
74
+ The examples below assume that you have `connected to a MongoDB replica set and have accessed a database
75
+ <https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/>`__
76
+ that contains an ``inventory`` collection.
77
+
71
78
- id: ruby
72
79
content: |
73
80
The examples below assume that you have `connected to a MongoDB replica set and have accessed a database
@@ -144,6 +151,16 @@ as long as a connection to the MongoDB deployment remains open *and* the collect
144
151
:start-after: Start Changestream Example 1
145
152
:end-before: End Changestream Example 1
146
153
154
+ - id: php
155
+ content: |
156
+ .. class:: copyable-code
157
+
158
+ .. literalinclude:: /driver-examples/DocumentationExamplesTest.php
159
+ :language: php
160
+ :dedent: 8
161
+ :start-after: Start Changestream Example 1
162
+ :end-before: End Changestream Example 1
163
+
147
164
- id: ruby
148
165
content: |
149
166
.. class:: copyable-code
@@ -212,6 +229,15 @@ Lookup Full Document for Update Operations
212
229
document, pass ``{ fullDocument: 'updateLookup' }`` to the
213
230
:method:`collection.watch()` method.
214
231
232
+ - id: php
233
+ content: |
234
+
235
+ By default, change streams only return the delta of fields
236
+ during the u pdate operation. To return the most current
237
+ majority-committed version of the updated document, pass
238
+ ``"fullDocument' => \MongoDB\Operation\ChangeStreamCommand::FULL_DOCUMENT_UPDATE_LOOKUP"``
239
+ to the :method:`watch()` method.
240
+
215
241
- id: ruby
216
242
content: |
217
243
By default, change streams only return the delta of fields during the update operation.
@@ -297,12 +323,22 @@ update operation.
297
323
:start-after: Start Changestream Example 2
298
324
:end-before: End Changestream Eample 2
299
325
326
+ - id: php
327
+ content: |
328
+ .. class:: copyable-code
329
+
330
+ .. literalinclude:: /driver-examples/DocumentationExamplesTest.php
331
+ :language: php
332
+ :dedent: 8
333
+ :start-after: Start Changestream Example 2
334
+ :end-before: End Changestream Example 2
335
+
300
336
- id: ruby
301
337
content: |
302
338
.. class:: copyable-code
303
339
304
340
.. literalinclude:: /driver-examples/change_stream_examples_spec.rb
305
- :language: php
341
+ :language: ruby
306
342
:dedent: 4
307
343
:start-after: Start Changestream Example 2
308
344
:end-before: End Changestream Example 2
@@ -501,6 +537,29 @@ Resume a Change Stream
501
537
:start-after: Start Changestream Example 3
502
538
:end-before: End Changestream Example 3
503
539
540
+ - id: php
541
+ content: |
542
+
543
+ Each change stream response document has an ``_id`` field
544
+ which can be passed to the ``watch()`` method, indicating to
545
+ the method at what point in th e iteration of the change
546
+ stream it should resume.
547
+
548
+ In the example below, the ``resumeAfter`` option is passed to
549
+ the ``watch()`` method with a value of the ``_id`` of the last
550
+ document processed, in order to recreate the stream after it
551
+ has been destroyed. Passing the ``_id`` to the change stream
552
+ attempts to resume notifications starting at the operation
553
+ specified.
554
+
555
+ .. class:: copyable-code
556
+
557
+ .. literalinclude:: /driver-examples/DocumentationExamplesTest.php
558
+ :language: php
559
+ :dedent: 8
560
+ :start-after: Start Changestream Example 3
561
+ :end-before: End Changestream Example 3
562
+
504
563
- id: ruby
505
564
content: |
506
565
Each change stream response document has an ``_id`` field which can be passed
0 commit comments