[GODRIVER-707] method/operation to determine if a write error is a duplicate key error Created: 15/Dec/18  Updated: 27/Oct/23  Resolved: 10/Jan/19

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 0.3.0

Type: Improvement Priority: Major - P3
Reporter: Sam Kleinman (Inactive) Assignee: Divjot Arora (Inactive)
Resolution: Works as Designed Votes: 0
Labels: evg
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates GODRIVER-972 add IsDuplicateKey(err) helper Closed

 Description   

this might just be a usability consideration, but I can't find anyway to determine or check if an error from an insert or an upsert is a duplicate key error, without (presumably, parsing the string form of the error, which looks to be derived from what the server transmits.



 Comments   
Comment by Divjot Arora (Inactive) [ 10/Jan/19 ]

Duplicate key errors can be captured by casting the error from an InsertOne or InsertMany to mongo.WriteErrors or mongo.BulkWriteException, respectively.

Comment by Ian Whalen (Inactive) [ 07/Jan/19 ]

Probably do the same thing we did for the topology disconnected error and find all of the places we used it and replace command.Error with mongo.CommandError.

Generated at Thu Feb 08 08:34:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.