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

Getting a new Database from mongo.Client does not honor a Registry from DatabaseOptions

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.2
    • Affects Version/s: 1.1.0
    • Component/s: API
    • None

      Creating a new registry from an existing mongo.Client ignores a registry passed in from the DatabaseOptions:

       

       

      vd := func(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
        ...
      }
      
      reg := bson.NewRegistryBuilder().
          RegisterDecoder(reflect.TypeOf(custom.JSONTime{}),
          bsoncodec.ValueDecoderFunc(vd)).Build()
      
      
      db := mongoClient.Database(scoir.Env.DbName, options.Database().SetRegistry(reg))
       
      

       

      Looking at the code in database.go shows that the creation of a new database ignores the options and just takes the registry from the client.

       

            Assignee:
            alice.thum@mongodb.com Alice Thum
            Reporter:
            phil@scoir.com Phil Feairheller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: