[GODRIVER-549] Add ObjectID struct tag for strings Created: 10/Sep/18 Updated: 06/Feb/23 |
|
| Status: | Backlog |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kristofer Brandow (Inactive) | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Add and implement a new struct tag that allows strings to be used as ObjectIDs. This will require adding support to the ObjectIDCodec and the StringCodec to recognize the struct tag and handle the values accordingly. |
| Comments |
| Comment by Danny Paul [ 15/Sep/19 ] |
|
Really painful not having this feature. Usually we end up having duplicate structs, with just the ObjectID field being different. Would really love to have this feature. Thanks Danny |
| Comment by Kristofer Brandow (Inactive) [ 04/Oct/18 ] |
|
The work in |
| Comment by Emmanuel Leroy [ 04/Oct/18 ] |
|
Thanks Kris,
That helps... Still a bit of a pain to have to convert documents to another to output to json. A flag on the ToExtJSON method to define how to parse ObjectID would be welcome.
|
| Comment by Kristofer Brandow (Inactive) [ 03/Oct/18 ] |
|
Hi eleroy,
There are currently functions and methods in the objectid package that allow an objectid.ObjectID to be turned into a string representation. These are the Hex method and the FromHex function. Thanks, Kris |
| Comment by Emmanuel Leroy [ 03/Oct/18 ] |
|
This says to supersedes 533 but I think it is a bit of a different problem. It is quite a pain that the ObjectId parses as an array of integers instead of a string. Is there a workaround in the mean time? |