Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions source/tutorial/update-documents-with-aggregation-pipeline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ aggregation pipeline to update the document with ``_id: 3``:
Specifically, the pipeline consists of a :pipeline:`$set` stage
which adds the ``test3`` field (and sets its value to ``98``) to the
document and sets the ``modified`` field to the current datetime.
For the current datetime, the operation uses the aggregation
variable :variable:`NOW` for the (to access the variable, prefix with ``$$``
and enclose in quotes).
The operation uses the aggregation variable :variable:`NOW` for the
current datetime. To access the variable, prefix with ``$$`` and enclose
in quotes.

To verify the update, you can query the collection:

Expand Down Expand Up @@ -120,14 +120,14 @@ Specifically, the pipeline consists of:
:expression:`$mergeObjects` expression to set default values for
the ``quiz1``, ``quiz2``, ``test1`` and ``test2`` fields. The
aggregation variable :variable:`ROOT` refers to the current
document being modified (to access the variable, prefix with
``$$`` and enclose in quotes). The current document fields will
document being modified. To access the variable, prefix with
``$$`` and enclose in quotes. The current document fields will
override the default values.

- a :pipeline:`$set` stage to update the ``modified`` field to the
current datetime. For the current datetime, the operation uses the
aggregation variable :variable:`NOW` for the (to access the
variable, prefix with ``$$`` and enclose in quotes).
current datetime. The operation uses the aggregation variable
:variable:`NOW` for the current datetime. To access the variable,
prefix with ``$$`` and enclose in quotes.

To verify the update, you can query the collection:

Expand Down Expand Up @@ -192,9 +192,9 @@ Specifically, the pipeline consists of:
of the ``tests`` array elements and to update the ``modified``
field to the current datetime. To calculate the truncated average,
the stage uses the :group:`$avg` and :expression:`$trunc`
expressions. For the current datetime, the operation uses the
aggregation variable :variable:`NOW` for the (to access the
variable, prefix with ``$$`` and enclose in quotes)
expressions. The operation uses the aggregation variable
:variable:`NOW` for the current datetime. To access the variable,
prefix with ``$$`` and enclose in quotes.

- a :pipeline:`$set` stage to add the ``grade`` field based on the
``average`` using the :expression:`$switch` expression.
Expand Down