Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
Fully Compatible
-
Not Needed
-
Description
The current driver 4.3.0-beta3 does not seem to propagate the error code from the WriteError to the MongoWriteException in case of an E11000.
With 4.2 drivers the error code matched.
try { |
MongoCollection<org.bson.Document> collection = client.getDatabase("test").getCollection("write-error-tests"); |
collection.insertOne(new org.bson.Document("_id", "id-1")); |
collection.insertOne(new org.bson.Document("_id", "id-1")); |
} catch (MongoServerException e) { |
System.out.println("ServerException Code: " + e.getCode()); |
System.out.println("WriteError Code : " + ((MongoWriteException)e).getError().getCode()); |
}
|
Attachments
Issue Links
- is duplicated by
-
JAVA-4922 Error Code from WriteError not propagated to MongoServerException (3.12.x line)
-
- Closed
-