[GODRIVER-323] Struct with bson tag _id inserts a byte array instead of objectId Created: 03/Apr/18 Updated: 28/Oct/23 Resolved: 06/Apr/18 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | 0.0.3 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ad | Assignee: | Kristofer Brandow (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
When having a struct like this:
This creates a byte[12] (Binary) value in the database instead of an objectID. When removing the `bson: "_id"` tag. It automatically creates a correct objectID. But then there is no bson mapping to the ID field in the struct. |
| Comments |
| Comment by Kristofer Brandow (Inactive) [ 06/Apr/18 ] |
|
No problem, thanks for the bug report! |
| Comment by Ad [ 06/Apr/18 ] |
|
Did a quick test and I can confirm that it works. |
| Comment by Kristofer Brandow (Inactive) [ 05/Apr/18 ] |
|
Hi Ad, I've just merged a commit that should fix this problem. Please test and let me know if it works for you. --Kris |
| Comment by Githook User [ 05/Apr/18 ] |
|
Author: {'email': 'kris@mongodb.com', 'name': 'Kris Brandow', 'username': 'skriptble'}Message: Add support for encoding ObjectIDs Added support for struct fields, map keys, map values, and slice values Change-Id: I070fef2199022ca47dcee3546054e3f6be077ff2 |
| Comment by Ad [ 03/Apr/18 ] |
|
Great, thanks! |
| Comment by Kristofer Brandow (Inactive) [ 03/Apr/18 ] |
|
Hi Ad, It looks like we aren't actually explicitly checking for an objectid.ObjectID so the type is being interpreted as [12]byte instead. I've added --Kris |