-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
-
Currently the mongo.UpdateResult and mongo.DeleteResult types support unmarshaling from BSON (either via an UnmarshalBSON function or struct tags). However, the BSON unmarshaling logic is sometimes inconsistent with the logic used to form those result types in the operation layer. The ability to unmarshal directly from BSON appears to be vestigial from an earlier version of the driver before the CRUD spec tests, is (mostly?) unused, and potentially confusing.
Remove the mongo.UpdateResult.UnmarshalBSON function and remove the BSON struct tags from mongo.DeleteResult in the v2.0 Go driver.
Additionally, other result types support unmarshaling from BSON via an exported UnmarshalBSON function:
- mongo.CollectionSpecification
- mongo.IndexSpecification
- gridfs.File
Those UnmarshalBSON functions are actually used to unmarshal the results right now, but don't need to be on an exported type. Remove the UnmarshalBSON function from those exported result types, move them to the existing unmarshal[result type] types, and move the unmarshal type to result type conversion into the relevant functions instead of in the UnmarshalBSON function.
- depends on
-
GODRIVER-2606 Deprecate unused functionality in preparation to remove it in Go Driver 2.0
- Closed