Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
0.0.2
-
None
-
None
Description
The BSON encoder does not handle struct properties that can be nil. If it does encounter a nil struct property it returns an error when it should encode that value into a BSON Null.
To fix this:
- Update underlyingVal to check if the value is nil when it's Kind is either a reflect.Ptr or a reflect.Interface. If it is, don't return the underlying Elem, instead return the pointer or interface.
- In encodeMap, encodeSlice, encodeSliceAsArray, and encodeStruct, after calling underlyingVal, if the kind is an interface, map, pointer, or slice, and it is nil, return a BSON Null type.
Attachments
Issue Links
- is depended on by
-
GODRIVER-315 Mongo shipped BSON marshaller to support nested structs using embedding
-
- Closed
-
- is duplicated by
-
GODRIVER-315 Mongo shipped BSON marshaller to support nested structs using embedding
-
- Closed
-