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

Allow setting "bson.Encoder" and "bson.Decoder" configurations via "ClientOptions"

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.12.0
    • Affects Version/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?

      GODRIVER-2716 adds a new API for configuring bson.Encoder and bson.Decoder that significantly simplifies applying many configurations compared to overriding the default Registry. However, users need a way to apply those configurations in mongo.Connect via ClientOptions.

      An example options struct:

      type BSONOptions struct {
      	Registry                        *bsoncodec.Registry
      	AllowUnexported                 bool
      	UseJSONStructTags               bool
      	EncodeIntMinSize                bool
      	EncodeMapKeysWithStringer       bool
      	EncodeNilByteSliceAsEmpty       bool
      	EncodeNilMapAsEmpty             bool
      	EncodeNilSliceAsEmpty           bool
      	EncodeOmitDefaultStruct         bool
      	EncodeOverwriteInlineDuplicates bool
      	DecodeDefaultDocumentM          bool
      	DecodeBinaryAsSlice             bool
      	DecodeObjectIDAsHexString       bool
      	DecodeZerosMap                  bool
      	DecodeZerosStruct               bool
      }
      

      Definition of done:

      • Users have a way to set all bson.Encoder and bson.Decoder configuration options in a ClientOptions passed to mongo.Connect (including setting a Registry).
      • Deprecate ClientOptions.Registry and ClientOptions.SetRegistry.

            Assignee:
            matt.dale@mongodb.com Matt Dale
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: