[GODRIVER-681] Cursors and SingleResult ignore client custom registry Created: 09/Dec/18 Updated: 28/Oct/23 Resolved: 20/Dec/18 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Core API |
| Affects Version/s: | 0.1.0 |
| Fix Version/s: | 0.2.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aleksandr Sokolovskii | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
golang 1.11.2, Windows 10 |
||
| Issue Links: |
|
||||||||
| Description |
|
Case: My code is: func (e *ProtoWrappersValueCodec) EncodeValue(ectx bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error { ... some code }func (e *ProtoWrappersValueCodec) DecodeValue(ectx bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error { ... some code }
I provide custom registry when create new client: client, err := mongo.NewClientWithOptions("mongodb://localhost:27017", ) So InsertOne command works great. BSON Encoder calls custom encoders. Please let me know if you need more details. |
| Comments |
| Comment by Githook User [ 20/Dec/18 ] | ||||||||||||||||||||
|
Author: {'username': 'divjotarora', 'email': 'divjot.arora@10gen.com', 'name': 'Divjot Arora'}Message: Pass custom registry to topology options. Change-Id: I50ac9930acd72719274a03357a20eb841a346c32 | ||||||||||||||||||||
| Comment by Divjot Arora (Inactive) [ 17/Dec/18 ] | ||||||||||||||||||||
|
Code review: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/437530 | ||||||||||||||||||||
| Comment by Aleksandr Sokolovskii [ 12/Dec/18 ] | ||||||||||||||||||||
|
Great. Thank you very much! | ||||||||||||||||||||
| Comment by Divjot Arora (Inactive) [ 12/Dec/18 ] | ||||||||||||||||||||
|
amsokol We'll be putting the fix for this issue in the SetRegistry() function in the options/clientoptions.go file to add the registry to topology options as well as the options struct. In general, we recommend using the Set* functions to create options structs as they may have some extra logic in addition to setting struct fields. | ||||||||||||||||||||
| Comment by Aleksandr Sokolovskii [ 11/Dec/18 ] | ||||||||||||||||||||
|
Is my fix correct? I can create pull request easy. Should I? | ||||||||||||||||||||
| Comment by Aleksandr Sokolovskii [ 11/Dec/18 ] | ||||||||||||||||||||
|
I think the fix should be the following: File: mongo-go-driver\mongo\client.go Func: newClient
Old code:
New Code:
|