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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 1.1.2
    • 1.1.0
    • API
    • None

    Description

      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.

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: