@@ -209,94 +209,49 @@ UpdateOne() Example: Full File
209
209
210
210
.. include:: /includes/usage-examples/example-intro.rst
211
211
212
- The following example is a fully runnable file that finds and updates an
213
- existing document in the ``restaurants`` collection. Select the
214
- :guilabel:`Struct` or :guilabel:`bson.D` tab to see the corresponding code:
212
+ The following example is a fully runnable file that performs the following
213
+ actions on the ``restaurants`` collection:
215
214
216
- .. tabs::
215
+ - Finds a document with a specific ``_id``
216
+ - Updates the ``avg_rating`` field value of the matched document
217
217
218
- .. tab:: Struct
219
- :tabid: structExample
220
-
221
- The following code uses a struct to define the filter and update a document in the ``restuarants`` collection:
222
-
223
- .. io-code-block::
224
- :copyable: true
225
-
226
- .. input:: /includes/usage-examples/code-snippets/updateOne.go
227
- :language: go
228
- :dedent:
229
-
230
- .. output::
231
- :language: none
232
- :visible: false
233
-
234
- Documents updated: 1
235
-
236
- .. tab:: bson.D
237
- :tabid: bsonDExample
238
-
239
- The following code uses a ``bson.D`` type to define the filter and update a document in the ``restuarants`` collection:
240
-
241
- .. io-code-block::
242
- :copyable: true
218
+ .. io-code-block::
219
+ :copyable: true
243
220
244
- .. input:: /includes/usage-examples/code-snippets/updateOneBson .go
245
- :language: go
246
- :dedent:
221
+ .. input:: /includes/usage-examples/code-snippets/updateOne .go
222
+ :language: go
223
+ :dedent:
247
224
248
- .. output::
249
- :language: none
250
- :visible: false
225
+ .. output::
226
+ :language: none
227
+ :visible: false
251
228
252
- Documents updated: 1
229
+ Documents updated: 1
253
230
254
231
UpdateMany() Example: Full File
255
232
-------------------------------
256
233
257
234
.. include:: /includes/usage-examples/example-intro.rst
258
235
259
- The following example is a fully runnable file that finds and updates multiple
260
- existing documents in the ``restaurants`` collection. Select the
261
- :guilabel:`Struct` or :guilabel:`bson.D` tab to see the corresponding code:
236
+ The following example is a fully runnable file that performs the following
237
+ actions on the ``restaurants`` collection:
262
238
263
- .. tabs::
239
+ - Finds documents with the ``cuisine`` field value of ``"Pizza"`` and the
240
+ ``borough`` field value of ``"Brooklyn"``
241
+ - Updates the ``avg_rating`` field value of the matched documents
264
242
265
- .. tab:: Struct
266
- :tabid: structExample
267
-
268
- The following code uses a struct to define the filter and update multiple documents in the ``restuarants`` collection:
269
-
270
- .. io-code-block::
271
- :copyable: true
272
-
273
- .. input:: /includes/usage-examples/code-snippets/updateMany.go
274
- :language: go
275
- :dedent:
276
-
277
- .. output::
278
- :language: none
279
- :visible: false
280
-
281
- Documents updated: 296
282
-
283
- .. tab:: bson.D
284
- :tabid: bsonDExample
285
-
286
- The following code uses a ``bson.D`` type to define the filter and update multiple documents in the ``restuarants`` collection:
287
-
288
- .. io-code-block::
289
- :copyable: true
243
+ .. io-code-block::
244
+ :copyable: true
290
245
291
- .. input:: /includes/usage-examples/code-snippets/updateManyBson .go
292
- :language: go
293
- :dedent:
246
+ .. input:: /includes/usage-examples/code-snippets/updateMany .go
247
+ :language: go
248
+ :dedent:
294
249
295
- .. output::
296
- :language: none
297
- :visible: false
250
+ .. output::
251
+ :language: none
252
+ :visible: false
298
253
299
- Documents updated: 296
254
+ Documents updated: 296
300
255
301
256
Additional Information
302
257
----------------------
0 commit comments