|
Hi clausly4@gmail.com,
These error messages are actually generated by the MongoDB server. The driver does not do any processing here, except for taking the server's response and unmarshalling it into the proper error type (in this case likely a mongo.WriteException or mongo.BulkWriteException). It's not feasible for us to add a method to the driver for this because we wouldn't be able to guarantee that it works for all existing and future server versions.
You mentioned driver updates, so I also want to clarify that a driver update should not break your code if you decided to do this yourself because the driver will always relay the server's responses. I do recommend using a substring check (e.g strings.Contains() rather than a string equality check because the driver may decorate the server's response with some additional information if necessary.
Given this, I'm going to close this ticket. Feel free to leave a comment or open another ticket if you have any further questions.
– Divjot
|