-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 1.4.4
-
Component/s: BSON
-
None
-
Environment:go 1.15.6
when set slice point to struct. bson can not decode value in to the origin object
compare to json package. json works well
// code placeholder type Data struct { Name string `bson:"name"` } type Demo struct { Total []Total `bson:"total"` Data []Data `bson:"data"` } var new = Demo{ Total: []Total{ { Count: 100, }, }, Data: []Data{ { "Alice", }, }, } type receiver struct { Total interface{} Data interface{} } func TestUnmarshalBson(t *testing.T) { // a,b not get the value I want a := make([]Total, 0) b := make([]Data, 0) recv := receiver{ Total: &a, Data: &b, } }
- is depended on by
-
GODRIVER-3205 Make DistinctResult use the Collection's BSONOptions when decoding results
- Closed
- is duplicated by
-
GODRIVER-2382 Unmarshaling BSON into a struct with interface fields containing concrete value types doesn't work as expected.
- Closed