-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
This would be equivalent to MGO's "IsDup" and provide a simple way to handle duplicate key issues.
I think the implementation would look something like this:
func isMongoDupKey(err error) bool { wce, ok := err.(mongo.WriteConcernError) if !ok { return false } return wce.Code == 11000 || wce.Code == 11001 || wce.Code == 12582 || wce.Code == 16460 && strings.Contains(wce.Message, " E11000 ") }
- duplicates
-
GODRIVER-1803 Add error API improvements helpers
- Closed
- is duplicated by
-
GODRIVER-707 method/operation to determine if a write error is a duplicate key error
- Closed