[GODRIVER-1325] Getting a new Database from mongo.Client does not honor a Registry from DatabaseOptions Created: 30/Sep/19  Updated: 28/Oct/23  Resolved: 03/Oct/19

Status: Closed
Project: Go Driver
Component/s: API
Affects Version/s: 1.1.0
Fix Version/s: 1.1.2

Type: Bug Priority: Major - P3
Reporter: Phil Feairheller Assignee: Alice Thum
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.

 



 Comments   
Comment by Githook User [ 03/Oct/19 ]

Author:

{'username': 'athum', 'email': 'ayhthum@gmail.com', 'name': 'Alice Thum'}

Message: Use registry passed in from DatabaseOptions in newDatabase.

GODRIVER-1325

Change-Id: I6e63baf092a796c1e9ca01e4c84c8cac6f6af4ca
Branch: release/1.1
https://github.com/mongodb/mongo-go-driver/commit/d2ca53b8249c34f5da9fa33270f784422f921419

Comment by Githook User [ 02/Oct/19 ]

Author:

{'name': 'Alice Thum', 'username': 'athum', 'email': 'ayhthum@gmail.com'}

Message: Use registry passed in from DatabaseOptions in newDatabase.

GODRIVER-1325

Change-Id: I6e63baf092a796c1e9ca01e4c84c8cac6f6af4ca
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/678949548563fbbd6be4eab16bf913c9bb00817d

Comment by Githook User [ 02/Oct/19 ]

Author:

{'username': 'athum', 'email': 'ayhthum@gmail.com', 'name': 'Alice Thum'}

Message: Use registry passed in from DatabaseOptions in newDatabase.

GODRIVER-1325

Change-Id: I6e63baf092a796c1e9ca01e4c84c8cac6f6af4ca
Branch: GODRIVER-1325
https://github.com/mongodb/mongo-go-driver/commit/5f9510b60398374b60789b41afcb634c46cae482

Comment by Githook User [ 01/Oct/19 ]

Author:

{'username': 'athum', 'email': 'ayhthum@gmail.com', 'name': 'Alice Thum'}

Message: Use registry passed in from DatabaseOptions in newDatabase.

GODRIVER-1325

Change-Id: I55bd90e970f8b4e1ee65c5ab18799ec5f319cf36
Branch: GODRIVER-1325
https://github.com/mongodb/mongo-go-driver/commit/5fcfed49e8c6834461d4da863ec089971c4c3abf

Comment by Alice Thum [ 01/Oct/19 ]

https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/470028/1

Generated at Thu Feb 08 08:36:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.