[GODRIVER-2939] Clarify IsDuplicateKeyError()'s docs Created: 10/Aug/23  Updated: 28/Oct/23  Resolved: 18/Oct/23

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

Type: Improvement Priority: Unknown
Reporter: Felipe Gasper Assignee: Matt Dale
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

func IsDuplicateKeyError(err error) bool
    IsDuplicateKeyError returns true if err is a duplicate key error

This doesn't answer the question of what happens in the case of "hybrid" WriteException errors (e.g., a dupe-key plus some other WriteError).

It would be good for this function to clarify. (Based on the present implementation, as long as there is >=1 dupe-key error, the function returns true.)

Aside: In driver v2 "HasDuplicateKeyEerror" might be a better name?



 Comments   
Comment by Githook User [ 18/Oct/23 ]

Author:

{'name': 'Ramit Mittal', 'email': 'commitemailoframit@protonmail.com', 'username': 'ramitmittal'}

Message: GODRIVER-2939 Clarify IsDuplicateKeyError()'s docs (#1418)

Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/9b3e3c42adf0a63370bb03415ab62edd020b34b7

Comment by Matt Dale [ 17/Oct/23 ]

Community-contributed PR: https://github.com/mongodb/mongo-go-driver/pull/1418

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