@@ -623,6 +623,8 @@ Even though the write operation inserting a document with a duplicate key result
623
623
in an error, the other operations are executed because the write operation is
624
624
unordered.
625
625
626
+ .. _java-bulk-insert-troubleshooting:
627
+
626
628
Troubleshooting
627
629
---------------
628
630
@@ -631,7 +633,7 @@ Troubleshooting
631
633
Bulk Write Exception
632
634
~~~~~~~~~~~~~~~~~~~~
633
635
634
- The driver creates write exceptions when a ``WriteError`` object is created. If an
636
+ The driver creates a write exception when a ``WriteError`` object is created. If an
635
637
error is detected during a bulk write operation, a `MongoBulkWriteException
636
638
<{+core-api+}/MongoBulkWriteException.html>`__ is thrown.
637
639
@@ -643,7 +645,7 @@ Example
643
645
'''''''
644
646
645
647
For example, the driver raises a ``MongoBulkWriteException`` if your bulk insert
646
- contains two documents into a collection that violate the collection's schema
648
+ contains two documents that violate the collection's schema
647
649
validation rules. Suppose the collection has a rule where the value of the
648
650
``quantity`` field must be an ``int`` type. If your bulk insert contains a
649
651
document with a ``quantity`` of ``"three"`` and another with a ``quantity`` of
@@ -674,11 +676,15 @@ document with a ``quantity`` of ``"three"`` and another with a ``quantity`` of
674
676
com.mongodb.internal.connection.ProtocolHelper.getBulkWriteException(ProtocolHelper.java:254)
675
677
... 19 more
676
678
677
- This exception message contains a list of the two ``WriteError`` objects. The
678
- description in the ``MongoBulkWriteException`` object is vague as
679
- documents associated with the same bulk operation could produce different error
680
- types. Refer to the individual ``WriteError`` objects' ``message`` fields to
681
- determine the cause of each error.
679
+
680
+ In the preceding error message, the ``MongoBulkWriteException`` object provides
681
+ a vague description of the error, as documents associated with the same bulk
682
+ operation could produce different error types. Instead, refer to the
683
+ ``WriteError`` objects' ``message`` fields to determine the cause of each error.
684
+ Refer to the ``WriteError`` objects' ``details`` field for more specific
685
+ information, such as the schema rules and the offending documents. To address
686
+ this error, you must either revise the document to adhere to the schema
687
+ validation rules or bypass validation.
682
688
683
689
Additional Information
684
690
----------------------
0 commit comments