Skip to content

Fixes for the db.collection.update() page #1739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
30 changes: 15 additions & 15 deletions source/reference/method/db.collection.update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Definition
.. method:: db.collection.update(query, update, options)

Modifies an existing document or documents in a collection. The
method can modify specific fields of existing document or documents
method can modify specific fields of an existing document or documents
or replace an existing document entirely, depending on the
:ref:`update parameter <update-parameter>`.

Expand Down Expand Up @@ -40,7 +40,7 @@ Definition
.. include:: /reference/method/db.collection.update-param.rst

.. versionchanged:: 2.6
The :method:`~db.collection.update()` returns an object that
The :method:`~db.collection.update()` method returns an object that
contains the status of the operation.

:returns: A :ref:`writeresults-update` object that contains the
Expand Down Expand Up @@ -74,7 +74,7 @@ Update Specific Fields
``````````````````````

If the ``<update>`` document contains :ref:`update operator
<update-operators>` expressions, such those using the
<update-operators>` expressions, such as those using the
:update:`$set` operator, then:

- The ``<update>`` document must contain *only* :ref:`update operator
Expand Down Expand Up @@ -113,7 +113,7 @@ The *upsert* creates the new document with either:

- The fields and values of the ``<update>`` parameter, or

- The fields and values of the both the ``<query>`` and ``<update>``
- The fields and values of both the ``<query>`` and ``<update>``
parameters. The *upsert* creates a document with data from both
``<query>`` and ``<update>`` if the ``<update>`` parameter contains
*only* :ref:`update operator <update-operators>` expressions.
Expand All @@ -130,7 +130,7 @@ Use Unique Indexes

Given a collection named ``people`` where no documents have a ``name``
field that holds the value ``Andy``. Consider when multiple clients
issue the following *update* with ``upsert`` operation at the same
issue the following *update* with an ``upsert`` parameter at the same
time:

.. code-block:: javascript
Expand All @@ -153,7 +153,7 @@ operation may result in an insert.
To prevent MongoDB from inserting the same document more than once,
create a :ref:`unique index <index-type-unique>` on the ``name``
field. With a unique index, if an applications issues a group of upsert
operations, *Exactly one* :method:`~db.collection.update()` would
operations, *exactly one* :method:`~db.collection.update()` would
successfully insert a new document.

The remaining operations would either:
Expand All @@ -175,7 +175,7 @@ If ``multi`` is set to ``true``, the :method:`~db.collection.update()`
method updates all documents that meet the ``<query>`` criteria. The
``multi`` update operation may interleave with other write operations.
For unsharded collections, you can override this behavior with the
:update:`$isolated` isolation operator, which isolates the update
:update:`$isolated` operator, which isolates the update
operation and blocks other write operations during the update.

If the :ref:`\<update\> <update-parameter>` document contains *only*
Expand Down Expand Up @@ -203,7 +203,7 @@ Update Specific Fields

To update specific fields in a document, use :ref:`update operators
<update-operators>` in the ``<update>`` parameter. If the ``<update>``
parameter refers to fields non-existent in the current document, the
parameter refers to non-existent fields in the current document, the
:method:`~db.collection.update()` method adds the fields to the
document.

Expand Down Expand Up @@ -342,7 +342,7 @@ is less than ``5``:
Override Default Write Concern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following operation to a replica set specifies a :doc:`write
The following operation on a replica set specifies a :doc:`write
concern </reference/write-concern>` of ``"w: majority"`` with a
``wtimeout`` of 5000 milliseconds such that the method returns after
the write propagates to a majority of the replica set members or the
Expand Down Expand Up @@ -427,7 +427,7 @@ perform the update using the position of the element and :term:`dot
notation`. Arrays in MongoDB are zero-based.

The following operation queries the :doc:`bios collection
</reference/bios-example-collection>` for the first document with
</reference/bios-example-collection>` for the first document with the
``_id`` field equal to ``1`` and updates the second element in the
``contribs`` array:

Expand Down Expand Up @@ -478,7 +478,7 @@ the first matching subdocument:
.. code-block:: javascript

db.bios.update(
{ _id: 6, "awards.by": "ACM" } ,
{ _id: 4, "awards.by": "ACM" } ,
{ $set: { "awards.$.by": "Association for Computing Machinery" } }
)

Expand All @@ -502,7 +502,7 @@ field:
In the next example, the :update:`$set` operator uses :ref:`dot
notation <document-dot-notation>` to access the ``middle`` field in the
``name`` subdocument. The :update:`$push`
operator adds another document as element to the field ``awards``.
operator adds another document as an element to the field ``awards``.

Consider the following operation:

Expand Down Expand Up @@ -530,7 +530,7 @@ This :method:`~db.collection.update()` operation:

- Adds an element to the field ``awards``, whose value is an array.
Specifically, the :update:`$push` operator adds another document as
element to the field ``awards``.
an element to the field ``awards``.

.. _writeresults-update:

Expand All @@ -542,9 +542,9 @@ WriteResult
Successful Results
~~~~~~~~~~~~~~~~~~

The :method:`~db.collection.update()` returns a :method:`WriteResult`
The :method:`~db.collection.update()` method returns a :method:`WriteResult`
object that contains the status of the operation. Upon success, the
:method:`WriteResult` object contains information on the number of
:method:`WriteResult` object contains the number of
documents that matched the query condition, the number of documents
inserted via an ``upsert``, and the number of documents modified:

Expand Down