-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.11.3
-
Component/s: Error Handling
-
None
-
Environment:Java Driver 2.11.3, Mongos + Mongo 2.4.8
An exception will not get converted to the expected type if a duplicate key error is the underlying error:
(hosts/ips/oids changed)
com.mongodb.WriteConcernException: { "serverUsed" : "mongosA/1.2.3.4:27017" , "err" : "error inserting 1 documents to shard shard0001:feeds1/fs1:27017,fs2:27017,fs3:27017,fs4:27017,fs5:27017 at version 37|1||52a65f219cdffac001be7e80 :: caused by :: E11000 duplicate key error index: foursquare.collA.$id dup key: { : { t: \"s\", o: ObjectId('xyz'), v: ObjectId('abc') } }" , "code" : 16460 , "n" : 0 , "ok" : 1.0}
I believe this happens when the mongos adds the duplicate key error as a "caused by" error.
- depends on
-
SERVER-11493 Use a specific error code for duplicate key error when sharded
- Closed
- is related to
-
PYTHON-592 OperationFailure is raised instead of DuplicateKeyError
- Closed
-
JAVA-1081 CommandResult.getException not detecting duplicate key errors reported in errObjects field
- Closed