Skip to content

Commit 12588df

Browse files
committed
Fix
1 parent d856c5d commit 12588df

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

source/includes/read/change-streams/open-change-stream.php renamed to source/includes/read/change-streams/change-stream.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ function toJSON(object $document): string
2929
}
3030
} while (! $changeStream->valid() || $changeStream->current()['operationType'] !== 'invalidate');
3131
// end-open-change-stream
32+
33+
// Updates a document that has a "name" value of "Blarney Castle"
34+
// start-update-for-change-stream
35+
$result = $collection->updateOne(
36+
['name' => 'Blarney Castle'],
37+
['$set' => ['cuisine' => 'Irish']]
38+
);
39+
// end-update-for-change-stream

source/read/change-streams.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ database from the :atlas:`Atlas sample datasets </sample-data>`. To access this
3838
from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster
3939
and assign the following value to your ``$collection`` variable:
4040

41-
.. literalinclude:: /includes/read/change-streams.php
41+
.. literalinclude:: /includes/read/change/streams/change-stream.php
4242
:language: php
4343
:dedent:
4444
:start-after: start-db-coll
@@ -53,7 +53,7 @@ Some examples use the ``toJSON()`` function to represent change events, which ar
5353
documents, as Extended JSON. To use this function, paste the following code into your
5454
application file:
5555

56-
.. literalinclude:: /includes/read/change-streams.php
56+
.. literalinclude:: /includes/read/change-streams/change-stream.php
5757
:language: php
5858
:dedent:
5959
:start-after: start-to-json
@@ -74,7 +74,7 @@ classes:
7474
The following example opens a change stream on the ``restaurants`` collection
7575
and outputs changes as they occur:
7676

77-
.. literalinclude:: /includes/read/change-streams.php
77+
.. literalinclude:: /includes/read/change-streams/change-stream.php
7878
:start-after: start-open-change-stream
7979
:end-before: end-open-change-stream
8080
:language: php
@@ -86,7 +86,7 @@ a document that has a ``name`` field value of ``'Blarney Castle'``:
8686

8787
.. _php-change-stream-update:
8888

89-
.. literalinclude:: /includes/read/change-streams.php
89+
.. literalinclude:: /includes/read/change-streams/change-stream.php
9090
:start-after: start-update-for-change-stream
9191
:end-before: end-update-for-change-stream
9292
:language: php
@@ -123,7 +123,7 @@ The following example passes a pipeline that includes the ``$match`` stage to th
123123
``watch()`` method. This instructs the ``watch()`` method to output events only
124124
when update operations occur:
125125

126-
.. literalinclude:: /includes/read/change-streams.php
126+
.. literalinclude:: /includes/read/change-streams/change-stream-pipeline.php
127127
:start-after: start-change-stream-pipeline
128128
:end-before: end-change-stream-pipeline
129129
:language: php
@@ -223,7 +223,7 @@ one of the following values:
223223
The following example calls the ``watch()`` method on a collection and includes the post-image
224224
of updated documents by setting the ``fullDocument`` option:
225225

226-
.. literalinclude:: /includes/read/change-streams.php
226+
.. literalinclude:: /includes/read/change-streams/change-stream-options.php
227227
:start-after: start-change-stream-post-image
228228
:end-before: end-change-stream-post-image
229229
:language: php

0 commit comments

Comments
 (0)