File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,19 @@ where the value of the ``name`` field is ``"Starbucks"``. The update document us
105
105
106
106
11 document(s) updated
107
107
108
+ Upsert Option
109
+ ~~~~~~~~~~~~~
110
+
111
+ The ``upsert`` parameter allows you to use the ``update_one()`` and
112
+ ``update_many()`` operations to perform a conditional operation:
113
+
114
+ - If the specified document exists, the command updates it.
115
+ - If the specified document does not exist, the command creates a new document
116
+ with the specified parameter.
117
+
118
+ For more information, see the :ref:`<ruby-upsert-example>` section or the :ref:`options
119
+ table <ruby-update-options-table>` on this page.
120
+
108
121
Customize the Update Operation
109
122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110
123
@@ -117,6 +130,8 @@ operation with default settings.
117
130
The following table describes the options that you can use to
118
131
configure the update operation:
119
132
133
+ .. _ruby-update-options-table:
134
+
120
135
.. list-table::
121
136
:widths: 30 70
122
137
:header-rows: 1
@@ -161,6 +176,8 @@ configure the update operation:
161
176
</reference/command/update/#std-label-update-let-syntax>` in the
162
177
{+mdb-server+} manual.
163
178
179
+ .. _ruby-upsert-example:
180
+
164
181
Modify Update Example
165
182
`````````````````````
166
183
You can’t perform that action at this time.
0 commit comments