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

Remove "bson.DefaultRegistry"

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Go Drivers
    • 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?

      The removal part of GODRIVER-3227.

      Context

      Currently it's possible to change the behavior of BSON encoding and decoding by modifying bson.DefaultRegistry. That behavior is extremely difficult to test and is easy to break unexpectedly. There are already APIs for setting registries, both for BSON encoders/decoders and for a mongo.Client. We should direct all users to modify BSON registries using those official configurations to prevent unintended behavior regressions when modifying how BSON registries are configured.

      Definition of done

      • Remove or unexport bson.DefaultRegistry in v2.0.
      • (Optional) Since a bson.Registry currently uses locks, sharing a bson.Registry between mongo.Client instances will create lock contention between what should be totally isolated types. Consider creating a new registry for every mongo.Client.

      Pitfalls

      • Some people use bson.DefaultRegistry to either access the default registry behavior or to globally modify the default registry. Those users will be impacted by this change and will need to configure their registry using another mechanism.

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: