[GODRIVER-606] Anonymous/embedded fields should be "inline-ed" by default Created: 19/Oct/18  Updated: 27/Oct/23  Resolved: 19/Nov/18

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

Type: Improvement Priority: Major - P3
Reporter: Mihai B Assignee: Unassigned
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently it seems that in order to "inline" a field it must have the "inline" tag even if it's an embedded/anonymous field. In Go, the standard practice is to "inline" the embedded fields. This behaviour exists in the std lib (i.e. encoding/json, encoding/xml) so I believe the mongo driver/bson should follow the same practice. 



 Comments   
Comment by Kristofer Brandow (Inactive) [ 05/Nov/18 ]

Closing due to inactivity.

Comment by Kristofer Brandow (Inactive) [ 22/Oct/18 ]

Hi themihai,

While the JSON and XML packages do behave like this, the community Go driver's BSON library does not automatically inline. Users who wish to inline structs should either specify the inline property as a struct tag or use a custom encoder and decoder for their types.

Thanks,

Kris

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