Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2367

Un-export all result type BSON unmarshaling functions and BSON struct tags

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed
    • Hide

      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?

      Show
      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?

      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.

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: