@@ -202,11 +202,16 @@ pass a list of these instances to the ``bulk_write()`` method. Call the
202
202
``bulk_write()`` method on a ``Collection`` instance to write to a single
203
203
collection or a ``MongoClient`` instance to write to multiple namespaces.
204
204
205
- If any of the write operations fail, {+driver-short+} raises a
205
+ If any of the write operations called on a ``Collection`` fail, {+driver-short+} raises a
206
206
``BulkWriteError`` and does not perform any further operations.
207
207
``BulkWriteError`` provides a ``details`` attribute that includes the operation
208
208
that failed, and details about the exception.
209
209
210
+ If any of the write operations called on a ``MongoClient`` fail, {+driver-short+} raises a
211
+ ``ClientBulkWriteException`` and does not perform any further operations.
212
+ ``ClientBulkWriteException`` provides an ``error`` attribute that includes
213
+ information about the exception.
214
+
210
215
.. note::
211
216
212
217
When {+driver-short+} runs a bulk operation, it uses the ``write_concern`` of the
@@ -225,13 +230,15 @@ The following example performs multiple write operations on the
225
230
on a ``Collection`` instance:
226
231
227
232
.. io-code-block::
233
+ :copyable:
228
234
229
235
.. input:: /includes/write/bulk-write.py
230
236
:start-after: start-bulk-write-mixed-collection
231
237
:end-before: end-bulk-write-mixed-collection
232
238
:language: python
233
239
234
240
.. output::
241
+ :visible: false
235
242
236
243
BulkWriteResult({'writeErrors': [], 'writeConcernErrors': [], 'nInserted': 2,
237
244
'nUpserted': 0, 'nMatched': 2, 'nModified': 2, 'nRemoved': 1, 'upserted': []},
@@ -248,13 +255,15 @@ namespaces by using the ``bulk_write()`` method on a ``MongoClient``
248
255
instance:
249
256
250
257
.. io-code-block::
258
+ :copyable:
251
259
252
260
.. input:: /includes/write/bulk-write.py
253
261
:start-after: start-bulk-write-mixed-client
254
262
:end-before: end-bulk-write-mixed-client
255
263
:language: python
256
264
257
265
.. output::
266
+ :visible: false
258
267
259
268
ClientBulkWriteResult({'anySuccessful': True, 'error': None, 'writeErrors': [],
260
269
'writeConcernErrors': [], 'nInserted': 1, 'nUpserted': 0, 'nMatched': 1,
@@ -533,3 +542,4 @@ guide, see the following API Documentation:
533
542
- `BulkWriteResult <{+api-root+}pymongo/results.html#pymongo.results.BulkWriteResult>`__
534
543
- `ClientBulkWriteResult <{+api-root+}pymongo/results.html#pymongo.results.ClientBulkWriteResult>`__
535
544
- `BulkWriteError <{+api-root+}pymongo/errors.html#pymongo.errors.BulkWriteError>`__
545
+ - `ClientBulkWriteException <{+api-root+}pymongo/errors.html#pymongo.errors.ClientBulkWriteException>`__
0 commit comments