-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Error Handling
-
None
Use case:
We're using the bulk write API to apply a set of changes to a collection. The set of individual bulk updates are populated dynamically prior to sending the command.
It's possible that under extreme cases, one of the bulk items is larger than the max bson size, which results in the call to BulkWrite returning an error. Currently, the only way to confirm that the error is due to exceeding the size limit is by importing "go.mongodb.org/mongo-driver/x/mongo/driver" and comparing to ErrDocumentTooLarge. However, this is a code smell since it introduces dependency on parts of the non-public facing package API.
Ideally, it would be possible to confirm if the bulk write failed as a result of the size error without needing to involve internal packages.