- 
    Type:
Improvement
 - 
    Resolution: Done
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: 0.0.2
 - 
    Component/s: None
 - 
    None
 
- 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
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.
 
- 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
 
 -