Skip to content

Commit

Permalink
DOCSP-36704 findAndModify Nit Edit (#6356)
Browse files Browse the repository at this point in the history
* DOCSP-36704 findAndModify Nit Edit

* include mongosh def

* JM feedback
  • Loading branch information
ajhuh-mdb authored Feb 14, 2024
1 parent 72bf96f commit c671b26
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion source/includes/extracts-fact-findandmodify-return.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ content: |
- If ``new`` is ``true``:
- the modified document if the query returns a match;
- the updated document if the query returns a match;
- the inserted document if ``upsert: true`` and no document matches the query;
Expand Down
26 changes: 13 additions & 13 deletions source/reference/command/findAndModify.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Definition

.. dbcommand:: findAndModify

The :dbcommand:`findAndModify` command modifies and returns a single
The :dbcommand:`findAndModify` command updates and returns a single
document. By default, the returned document does not include the
modifications made on the update. To return the document with the
modifications made on the update, use the ``new`` option.
Expand Down Expand Up @@ -92,7 +92,7 @@ The command takes the following fields:
employs the same :ref:`query selectors <query-selectors>` as used in
the :method:`db.collection.find()` method. Although the query may
match multiple documents, |operation|
**will only select one document to modify**.
**will only select one document to update**.

If unspecified, defaults to an empty document.

Expand All @@ -104,9 +104,9 @@ The command takes the following fields:
``sort``

- document
- Optional. Determines which document the operation modifies if the query selects
multiple documents. |operation| modifies
the first document in the sort order specified by this argument.
- Optional. Determines which document the operation updates if the query
selects multiple documents. |operation| updates the first document in the
sort order specified by this argument.

Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation
errors if the sort argument is not a document.
Expand Down Expand Up @@ -135,14 +135,14 @@ The command takes the following fields:

- Starting in MongoDB 4.2, if passed an :ref:`aggregation pipeline
<aggregation-pipeline>` ``[ <stage1>, <stage2>, ... ]``,
|operation| modifies the document per the pipeline. The pipeline
|operation| updates the document per the pipeline. The pipeline
can consist of the following stages:

.. include:: /includes/list-update-agg-stages.rst

* - ``new``
- boolean
- Optional. When ``true``, returns the modified document rather than the original.
- Optional. When ``true``, returns the updated document rather than the original.
The default is ``false``.

* - ``fields``
Expand Down Expand Up @@ -294,7 +294,7 @@ The ``lastErrorObject`` embedded document contains the following fields:

- Contains ``true`` if an ``update`` operation:

- Modified an existing document.
- Updated an existing document.
- Found the document, but it was already in the
desired destination state so no update actually occurred.

Expand Down Expand Up @@ -355,7 +355,7 @@ Shard Key Modification

.. include:: /includes/shard-key-modification-warning.rst

To modify the **existing** shard key value with
To update the **existing** shard key value with
:dbcommand:`findAndModify`:

- You :red:`must` run on a :binary:`~bin.mongos`. Do :red:`not`
Expand Down Expand Up @@ -499,7 +499,7 @@ This command performs the following actions:
"ok" : 1
}

To return the modified document in the ``value`` field, add the
To return the updated document in the ``value`` field, add the
``new:true`` option to the command.

If no document match the ``query`` condition, the command
Expand All @@ -525,7 +525,7 @@ following form:

However, the :method:`~db.collection.findAndModify()` shell helper
method returns only the unmodified document, or if ``new`` is
``true``, the modified document.
``true``, the updated document.

.. code-block:: javascript

Expand Down Expand Up @@ -745,7 +745,7 @@ Create a collection ``students`` with the following documents:
{ "_id" : 3, "grades" : [ 95, 110, 100 ] }
] )

To modify all elements that are greater than or equal to ``100`` in the
To update all elements that are greater than or equal to ``100`` in the
``grades`` array, use the positional :update:`$[\<identifier\>]`
operator with the ``arrayFilters`` option:

Expand Down Expand Up @@ -802,7 +802,7 @@ Create a collection ``students2`` with the following documents:

The following operation finds a document where the ``_id`` field equals
``1`` and uses the filtered positional operator :update:`$[\<identifier\>]` with
the ``arrayFilters`` to modify the ``mean`` for all elements in the
the ``arrayFilters`` to update the ``mean`` for all elements in the
``grades`` array where the grade is greater than or equal to ``85``.

.. code-block:: javascript
Expand Down
18 changes: 9 additions & 9 deletions source/reference/method/db.collection.findAndModify.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Definition
.. |dbcommand| replace:: :dbcommand:`findAndModify` command
.. include:: /includes/fact-mongosh-shell-method-alt.rst

Modifies and returns a single document. By default, the returned
Updates and returns a single document. By default, the returned
document does not include the modifications made on the update. To
return the document with the modifications made on the update, use
the ``new`` option.
Expand Down Expand Up @@ -101,8 +101,8 @@ parameter with the following embedded document fields:
``sort``

- document
- Optional. Determines which document the operation modifies if the query selects
multiple documents. |operation| modifies
- Optional. Determines which document the operation updates if the query
selects multiple documents. |operation| updates
the first document in the sort order specified by this argument.

Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation
Expand Down Expand Up @@ -132,14 +132,14 @@ parameter with the following embedded document fields:

- Starting in MongoDB 4.2, if passed an :ref:`aggregation pipeline
<aggregation-pipeline>` ``[ <stage1>, <stage2>, ... ]``,
|operation| modifies the document per the pipeline. The pipeline
|operation| updates the document per the pipeline. The pipeline
can consist of the following stages:

.. include:: /includes/list-update-agg-stages.rst

* - ``new``
- boolean
- Optional. When ``true``, returns the modified document rather than the original.
- Optional. When ``true``, returns the updated document rather than the original.
The default is ``false``.

* - ``fields``
Expand Down Expand Up @@ -287,7 +287,7 @@ Shard Key Modification

.. include:: /includes/shard-key-modification-warning.rst

To modify the **existing** shard key value with
To update the **existing** shard key value with
:method:`db.collection.findAndModify()`:

- You :red:`must` run on a :binary:`~bin.mongos`. Do :red:`not`
Expand Down Expand Up @@ -405,7 +405,7 @@ This method performs the following actions:
"score" : 5
}

To return the modified document, add the ``new:true`` option to
To return the updated document, add the ``new:true`` option to
the method.

If no document matched the ``query`` condition, the method
Expand Down Expand Up @@ -574,7 +574,7 @@ Create a collection ``students`` with the following documents:
{ "_id" : 3, "grades" : [ 95, 110, 100 ] }
] )

To modify all elements that are greater than or equal to ``100`` in the
To update all elements that are greater than or equal to ``100`` in the
``grades`` array, use the filtered positional operator
:update:`$[\<identifier\>]` with the ``arrayFilters`` option in the
:method:`db.collection.findAndModify` method:
Expand Down Expand Up @@ -630,7 +630,7 @@ Create a collection ``students2`` with the following documents:

The following operation finds a document where the ``_id`` field equals
``1`` and uses the filtered positional operator :update:`$[\<identifier\>]` with
the ``arrayFilters`` to modify the ``mean`` for all elements in the
the ``arrayFilters`` to update the ``mean`` for all elements in the
``grades`` array where the grade is greater than or equal to ``85``.

.. code-block:: javascript
Expand Down

0 comments on commit c671b26

Please sign in to comment.