Class WriteConcernError



  • public class WriteConcernError
    extends Object
    An error representing a failure by the server to apply the requested write concern to the bulk operation.
    Since:
    3.0
    MongoDB documentation
    Write Concern
    • Constructor Detail

      • WriteConcernError

        public WriteConcernError​(int code,
                                 String codeName,
                                 String message,
                                 BsonDocument details)
        Constructs a new instance.
        Parameters:
        code - the error code
        codeName - the error code name
        message - the error message
        details - any details
      • WriteConcernError

        @Deprecated
        public WriteConcernError​(int code,
                                 String message,
                                 BsonDocument details)
        Deprecated. 
        Constructs a new instance.
        Parameters:
        code - the error code
        message - the error message
        details - any details
    • Method Detail

      • getCode

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

        public String getCodeName​()
        Gets the name associated with the error code.
        Returns:
        the error code name, which may be the empty string
        Since:
        3.8
        Since server release
        3.4
      • getMessage

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

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

        public int hashCode​()
        Overrides:
        hashCode in class Object