Skip to content

Commit 9c934af

Browse files
committed
error type
1 parent 5af9b7b commit 9c934af

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

source/write/bulk-write.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,16 @@ pass a list of these instances to the ``bulk_write()`` method. Call the
202202
``bulk_write()`` method on a ``Collection`` instance to write to a single
203203
collection or a ``MongoClient`` instance to write to multiple namespaces.
204204

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
206206
``BulkWriteError`` and does not perform any further operations.
207207
``BulkWriteError`` provides a ``details`` attribute that includes the operation
208208
that failed, and details about the exception.
209209

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+
210215
.. note::
211216

212217
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
225230
on a ``Collection`` instance:
226231

227232
.. io-code-block::
233+
:copyable:
228234

229235
.. input:: /includes/write/bulk-write.py
230236
:start-after: start-bulk-write-mixed-collection
231237
:end-before: end-bulk-write-mixed-collection
232238
:language: python
233239

234240
.. output::
241+
:visible: false
235242

236243
BulkWriteResult({'writeErrors': [], 'writeConcernErrors': [], 'nInserted': 2,
237244
'nUpserted': 0, 'nMatched': 2, 'nModified': 2, 'nRemoved': 1, 'upserted': []},
@@ -248,13 +255,15 @@ namespaces by using the ``bulk_write()`` method on a ``MongoClient``
248255
instance:
249256

250257
.. io-code-block::
258+
:copyable:
251259

252260
.. input:: /includes/write/bulk-write.py
253261
:start-after: start-bulk-write-mixed-client
254262
:end-before: end-bulk-write-mixed-client
255263
:language: python
256264

257265
.. output::
266+
:visible: false
258267

259268
ClientBulkWriteResult({'anySuccessful': True, 'error': None, 'writeErrors': [],
260269
'writeConcernErrors': [], 'nInserted': 1, 'nUpserted': 0, 'nMatched': 1,
@@ -533,3 +542,4 @@ guide, see the following API Documentation:
533542
- `BulkWriteResult <{+api-root+}pymongo/results.html#pymongo.results.BulkWriteResult>`__
534543
- `ClientBulkWriteResult <{+api-root+}pymongo/results.html#pymongo.results.ClientBulkWriteResult>`__
535544
- `BulkWriteError <{+api-root+}pymongo/errors.html#pymongo.errors.BulkWriteError>`__
545+
- `ClientBulkWriteException <{+api-root+}pymongo/errors.html#pymongo.errors.ClientBulkWriteException>`__

0 commit comments

Comments
 (0)