Go Driver - strange behavior unmarshalling nested documents

Hello @Yishai_Berg,

This is an expected behavior, that has been addressed in GODRIVER-2407.

BSON has no existing provisions for retaining application-runtime-specific type information. All maps are encoded as embedded documents. Therefore, when we unmarshal such data, the decoder uses its ancestor type.

You can specify DefaultDocumentM in this case. Here is an example to unmarshal your data properly.

1 Like