Package com.mongodb

Class BulkWriteError



  • public class BulkWriteError
    extends java.lang.Object
    Represents an error for an item included in a bulk write operation, e.g. a duplicate key error
    Since:
    2.12
    MongoDB documentation
    BulkWriteResult.writeErrors
    Since server release
    2.6
    • Constructor Summary

      Constructors 
      Constructor Description
      BulkWriteError​(int code, java.lang.String message, DBObject details, int index)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getCode​()
      Gets the code associated with this error.
      DBObject getDetails​()
      Gets the details associated with this error.
      int getIndex​()
      The index of the item in the bulk write operation with this error.
      java.lang.String getMessage​()
      Gets the message associated with this error.
      int hashCode​()  
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BulkWriteError

        public BulkWriteError​(int code,
                              java.lang.String message,
                              DBObject details,
                              int index)
        Constructs a new instance.
        Parameters:
        code - the error code
        message - the error message
        details - details about the error
        index - the index of the item in the bulk write operation that had this error
    • Method Detail

      • getCode

        public int getCode​()
        Gets the code associated with this error.
        Returns:
        the code
      • getMessage

        public java.lang.String getMessage​()
        Gets the message associated with this error.
        Returns:
        the message
      • getDetails

        public DBObject getDetails​()
        Gets the details associated with this error. This document will not be null, but may be empty.
        Returns:
        the details
      • getIndex

        public int getIndex​()
        The index of the item in the bulk write operation with this error.
        Returns:
        the index
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object