@@ -185,13 +185,14 @@ guide.
185
185
Define an Update Document
186
186
-------------------------
187
187
188
- You can use factory methods from the ``Stage`` builder class to update
189
- or create field values in your update operations. To learn more about
190
- updating documents, see the :ref:`php-write-update` guide.
188
+ You can use the ``Stage::set()`` factory method when creating update
189
+ documents. Update documents describe the updates to make to target
190
+ documents. To learn more about updating documents, see the
191
+ :ref:`php-write-update` guide.
191
192
192
- .. important:: Only $set Operator Supported
193
+ .. important:: Only $set Operator Supported in Update Documents
193
194
194
- The only update operation that you can express by using builders uses
195
+ The only update operation that you can express with builders uses
195
196
the ``$set`` operator. This operator allows you to replace the value of
196
197
a field with a specified value or create a new field that has a specified
197
198
value. To learn more, see the :manual:`$set </reference/operator/update/set/>`
@@ -220,7 +221,7 @@ This example performs the following actions:
220
221
221
222
- Uses the ``Query::eq()`` factory method to match documents in which
222
223
the ``watlev`` field value is ``'partly submerged at high water'``
223
- - Uses the ``Stage::set()`` method to update the ``year`` field to ``1870``
224
+ - Uses the ``Stage::set()`` method to set the ``year`` field to ``1870``
224
225
- Calls the :phpmethod:`MongoDB\Collection::updateOne()`
225
226
method to perform the update
226
227
- Prints the number of updated documents
@@ -276,10 +277,10 @@ You can pass this pipeline to the following methods:
276
277
277
278
This example performs the following actions:
278
279
279
- - Uses the ``Stage::match()`` method to filter for only update change
280
- events
281
- - Uses the ``Stage::project()`` method to output only the specified change
282
- event fields
280
+ - Uses the ``Stage::match()`` method to filter for only change
281
+ events for update operations
282
+ - Uses the ``Stage::project()`` method to output only the
283
+ ``operationType``, ``ns`` (namespace), and ``fullDocument`` fields
283
284
- Calls the :phpmethod:`MongoDB\Collection::watch()`
284
285
method to open the change stream and sets the ``fullDocument`` option
285
286
to output the full document after update
@@ -304,3 +305,6 @@ This example performs the following actions:
304
305
"fullDocument":{"_id":...,"feature_type":"Wrecks - Visible",...},
305
306
"ns":{"db":"sample_geospatial","coll":"shipwrecks"}
306
307
}
308
+
309
+ To learn more about the information provided by change events, see
310
+ :manual:`Change Events <reference/change-events/>` in the {+mdb-server+} manual.
0 commit comments