You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/fundamentals/crud/write-operations/modify.txt
+70-23Lines changed: 70 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Update
44
44
45
45
Update operations can modify fields and values. They apply changes
46
46
specified in an update document to one or more documents that match your
47
-
query filter.
47
+
query filter.
48
48
49
49
The `updateOne() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#updateOne(org.bson.conversions.Bson,org.bson.conversions.Bson)>`__
50
50
method changes the first document your query filter matches and the
@@ -56,40 +56,73 @@ You can call the ``updateOne()`` and ``updateMany()`` methods on a
56
56
57
57
.. code-block:: java
58
58
59
-
collection.updateOne(query, updateDocument);
60
-
61
-
collection.updateMany(query, updateDocument);
59
+
collection.updateOne(<query>, <updateDocument>);
60
+
collection.updateMany(<query>, <updateDocument>);
62
61
63
62
Update Operation Parameters
64
63
~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
64
66
65
The ``updateOne()`` and ``updateMany()`` methods both have the following
67
66
parameters:
68
67
69
-
- ``query`` specifies a query filter with the criteria to match documents to update in your collection
70
-
- ``updateDocument`` specifies the fields and values to modify in the matching document or documents. For this example, we use the :doc:`Updates builder </fundamentals/builders/updates>` to create the update document.
68
+
- ``query`` specifies a query filter with the criteria to match
69
+
documents to update in your collection.
70
+
- ``update`` specifies the fields and values to modify in the matching
71
+
document or documents. The examples in this section use the
72
+
:ref:`updates-builders` to create the update document.
73
+
- *(Optional)* ``updateOptions`` specifies options that you can set to
74
+
customize how the driver performs the update operation. To learn more
75
+
about this type, see the API documentation for `UpdateOptions
0 commit comments