Package com.mongodb
Class ClientBulkWriteException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoServerException
com.mongodb.ClientBulkWriteException
- All Implemented Interfaces:
Serializable
The result of an unsuccessful or partially unsuccessful client-level bulk write operation.
Note that the code and labels from this exception are not useful.
An application should use those from the top-level error.
- Since:
- 5.3
- See Also:
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
Constructor Summary
ConstructorDescriptionClientBulkWriteException
(MongoException error, List<WriteConcernError> writeConcernErrors, Map<Integer, WriteError> writeErrors, ClientBulkWriteResult partialResult, ServerAddress serverAddress) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
The top-level error.The result of the part of a client-level bulk write operation that is known to be successful.TheWriteConcernError
s that occurred while executing the client-level bulk write operation.The indexedWriteError
s.Methods inherited from class com.mongodb.MongoServerException
getErrorCodeName, getServerAddress
Methods inherited from class com.mongodb.MongoException
addLabel, addLabels, addLabels, fromThrowable, fromThrowableNonNull, getCode, getErrorLabels, hasErrorLabel, removeLabel
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClientBulkWriteException
public ClientBulkWriteException(@Nullable MongoException error, @Nullable List<WriteConcernError> writeConcernErrors, @Nullable Map<Integer, WriteError> writeErrors, @Nullable ClientBulkWriteResult partialResult, ServerAddress serverAddress) Constructs a new instance.- Parameters:
error
- The top-level error.writeConcernErrors
- The write concern errors.writeErrors
- The write errors.partialResult
- The partial result.serverAddress
- The server address. Iferror
is aMongoServerException
or aMongoSocketException
, thenserverAddress
must be equal to theServerAddress
they bear.
-
-
Method Details
-
getCause
The top-level error. That is an error that is neither a write concern error, nor is an error of an individual write operation. -
getWriteConcernErrors
TheWriteConcernError
s that occurred while executing the client-level bulk write operation.There are no guarantees on mutability of the
List
returned.- Returns:
- The
WriteConcernError
s.
-
getWriteErrors
The indexedWriteError
s. The keys are the indexes of the correspondingClientNamespacedWriteModel
s in the corresponding client-level bulk write operation.There are no guarantees on mutability or iteration order of the
Map
returned. -
getPartialResult
The result of the part of a client-level bulk write operation that is known to be successful.- Returns:
- The successful partial result. Present only if the client received a response indicating success of at least one individual write operation.
-