[GODRIVER-636] Add documentation on how to set a custom bsoncodec.Registry Created: 13/Nov/18 Updated: 27/Oct/23 Resolved: 07/Jan/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Trivial - P5 |
| Reporter: | Tom Zierbock | Assignee: | Unassigned |
| Resolution: | Gone away | Votes: | 1 |
| Labels: | beta | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
At the moment it is not obvious how to set a custom registry, such that it is used both when writing to mongo and reading with a cursor.
Bellow an example of what is I had to do to get this t work: cod := &UUIDCodec{} rb.RegisterDecoder(reflect.PtrTo(tUUID), bsoncodec.ValueDecoderFunc(cod.DecodeValue)) reg := rb.Build() opt := &options.ClientOptions{ ), client, err := mongo.NewClientWithOptions(url, opt) |
| Comments |
| Comment by Kristofer Brandow (Inactive) [ 07/Jan/19 ] |
|
Hi tomzierbock, Given the change made in mongodb/mongo-go-driver/pull/122, I don't think we need to document this anymore. If you disagree, please reply back and we'll reopen this ticket. Thanks, Kris |