[GODRIVER-1030] Need fully functional examples on creating custom BSON handlers Created: 09/May/19 Updated: 16/Nov/21 Resolved: 08/Oct/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Quest Henkart | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
There is a lot of documentation in the bsoncodec package, there are even a few example blocks, however due to the nature and complexity of this package, I think it would be really useful to provide a mini example program illustrating how to create custom BSON handlers https://godoc.org/go.mongodb.org/mongo-driver/bson/bsoncodec |
| Comments |
| Comment by Divjot Arora (Inactive) [ 08/Oct/19 ] |
|
closing as duplicate of godriver-904 |
| Comment by Quest Henkart [ 18/May/19 ] |
|
just to give more context. There are a lot of reasons someone might want to create their on BSON un/Marshallers. In my case, I want to create a work around for https://jira.mongodb.org/projects/GODRIVER/issues/GODRIVER-1020 to extend the primitive.ObjectID type to make the JSON unmarshaller able to handle JSON payloads. However as a result of this bug https://jira.mongodb.org/projects/GODRIVER/issues/GODRIVER-1029 , I need to create a custom BSON marshaller and unmarshaller. I tried a lot of different patterns based on the documentation and the few examples, but could not figure out how to get it read by the registry or if I was even creating the marshaller properly |