@@ -210,8 +210,10 @@ that failed, and details about the exception.
210210.. note::
211211
212212 When {+driver-short+} runs a bulk operation, it uses the ``write_concern`` of the
213- collection in which the operation is running. The driver reports all write
214- concern errors after attempting all operations, regardless of execution order.
213+ collection or client on which the operation is running. You can also set
214+ a write concern for the operation when using the ``MongoClient.bulk_write()``
215+ method. The driver reports all write concern errors after attempting all operations,
216+ regardless of execution order.
215217
216218.. _pymongo-bulk-write-collection-ex:
217219
@@ -248,15 +250,16 @@ instance:
248250.. io-code-block::
249251
250252 .. input:: /includes/write/bulk-write.py
251- :start-after: start-bulk-write-mixed-collection
252- :end-before: end-bulk-write-mixed-collection
253+ :start-after: start-bulk-write-mixed-client
254+ :end-before: end-bulk-write-mixed-client
253255 :language: python
254256
255257 .. output::
256258
257- ClientBulkWriteResult({'writeErrors': [], 'writeConcernErrors': [], 'nInserted': 2,
258- 'nUpserted': 0, 'nMatched': 2, 'nModified': 2, 'nRemoved': 1, 'upserted': []},
259- acknowledged=True)
259+ ClientBulkWriteResult({'anySuccessful': True, 'error': None, 'writeErrors': [],
260+ 'writeConcernErrors': [], 'nInserted': 1, 'nUpserted': 0, 'nMatched': 1,
261+ 'nModified': 1, 'nDeleted': 344, 'insertResults': {}, 'updateResults': {},
262+ 'deleteResults': {}}, acknowledged=True, verbose=False)
260263
261264Customize Bulk Write Operations
262265-------------------------------
@@ -388,12 +391,24 @@ The following example calls the ``bulk_write()`` method from the preceding
388391:ref:`pymongo-bulk-write-client-ex` but sets the ``verbose_results`` option
389392to ``True``:
390393
391- .. literalinclude:: /includes/write/bulk-write.py
392- :start-after: start-bulk-write-verbose
393- :end-before: end-bulk-write-verbose
394- :language: python
394+ .. io-code-block::
395395 :copyable:
396396
397+ .. input:: /includes/write/bulk-write.py
398+ :start-after: start-bulk-write-verbose
399+ :end-before: end-bulk-write-verbose
400+ :language: python
401+
402+ .. output::
403+ :visible: false
404+
405+ ClientBulkWriteResult({'anySuccessful': True, 'error': None, 'writeErrors': [],
406+ 'writeConcernErrors': [], 'nInserted': 1, 'nUpserted': 0, 'nMatched': 1, 'nModified': 1,
407+ 'nDeleted': 344, 'insertResults': {0: InsertOneResult(ObjectId('...'),
408+ acknowledged=True)}, 'updateResults': {1: UpdateResult({'ok': 1.0, 'idx': 1, 'n': 1,
409+ 'nModified': 1}, acknowledged=True)}, 'deleteResults': {2: DeleteResult({'ok': 1.0,
410+ 'idx': 2, 'n': 344}, acknowledged=True)}}, acknowledged=True, verbose=True)
411+
397412Return Values
398413-------------
399414
@@ -448,7 +463,7 @@ The ``Collection.bulk_write()`` method returns a ``BulkWriteResult`` object. The
448463Client Bulk Write Return Value
449464~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
450465
451- The ``Client .bulk_write()`` method returns a ``ClientBulkWriteResult`` object. The
466+ The ``MongoClient .bulk_write()`` method returns a ``ClientBulkWriteResult`` object. The
452467``ClientBulkWriteResult`` object contains the following properties:
453468
454469.. list-table::
0 commit comments