[GODRIVER-1804] Investigate encoding/json tagged behavior Created: 01/Dec/20  Updated: 30/Mar/22

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Isabella Siu (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Look at how encoding/json handles tags and figure out how to incorporate that into bson. For example, if two fields map to the same name and one of them does so through json tags, the tagged field is used.



 Comments   
Comment by Isabella Siu (Inactive) [ 08/Dec/20 ]

For example, the struct:

val := struct {
 A   int32
 B   int32 `bson:"a" json:"A"`
}{30, 20}

would be marshaled by encoding/json to 

{"A":20}

, while bson would error with "duplicated key a"

Generated at Thu Feb 08 08:37:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.