File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,20 @@ Each update method requires the following parameters:
61
61
:manual:`Field Update Operators guide page</reference/operator/update-field/>` in the
62
62
{+mdb-server+} manual.
63
63
64
+ Upsert Option
65
+ ~~~~~~~~~~~~~
66
+
67
+ The ``upsert`` parameter allows you to use the ``update_one()`` and
68
+ ``update_many()`` operations to use one method to perform a conditional
69
+ operation:
70
+
71
+ - If the specified document exists, the command updates it
72
+ - If the specified document does not exist, the command creates a new document
73
+ with the specified parameter.
74
+
75
+ For more information, see the :ref:`<ruby-upsert-example>`
76
+ on this page, or the :ref:`<ruby-update-options-table>`.
77
+
64
78
Update One Document Example
65
79
~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
80
@@ -117,6 +131,8 @@ operation with default settings.
117
131
The following table describes the options that you can use to
118
132
configure the update operation:
119
133
134
+ .. _ruby-update-options-table:
135
+
120
136
.. list-table::
121
137
:widths: 30 70
122
138
:header-rows: 1
@@ -161,6 +177,8 @@ configure the update operation:
161
177
</reference/command/update/#std-label-update-let-syntax>` in the
162
178
{+mdb-server+} manual.
163
179
180
+ .. _ruby-upsert-example:
181
+
164
182
Modify Update Example
165
183
`````````````````````
166
184
You can’t perform that action at this time.
0 commit comments