[GODRIVER-1751] Struct codec does not honor custom codecs if another codec was used first Created: 16/Sep/20 Updated: 28/Oct/23 Resolved: 29/Sep/20 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Divjot Arora (Inactive) | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
Reproducible example: https://play.golang.org/p/uugW5Adb3-J In the example, the decodeInt function implements a value decoder for int32 that reads an int32 from the ValueReader and multiplies it by -1 before setting it in the struct. The expected output from the main function is {"int": {"$numberInt":"1"}} {Int:-1}but the actual output is {"int": {"$numberInt":"1"}} {Int:1}When using MarshalWithRegistry followed by UnmarshalWithRegistry, everything works as expected. When using Marshal followed by UnmarshalWithRegistry, the custom decoder is not honored. |
| Comments |
| Comment by Githook User [ 29/Sep/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |
| Comment by Githook User [ 29/Sep/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |