-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: 1.9.1
-
Component/s: BSON
-
None
Summary
I'm trying to unmarshal some document received from mongo into a struct. This struct has a member that is a map[string]interface but with an alias (type metadata map[string]interface{} {}in the example below). This map can contains any data, including other map[string]interface{}{}.
When unmarshalling the document, it's correctly parsing this member as type metadata, but it's also converting map that are included in the map as this the type metadata. I think it should be map[string]interface instead.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
1.9.1
How to Reproduce
https://go.dev/play/p/baefmEyupxI
Unmarshal as
{{main.data{Metadata:main.metadata{"foo":main.metadata
{"bar":"baz"}}}}}
But expected as
{{main.data{Metadata:main.metadata{"foo":map[string]interface {}
{"bar":"baz"}}}}}
Additional Background
Please provide any additional background information that may be helpful in diagnosing the bug.
- related to
-
GODRIVER-2819 Make BSON decode to bson.D if there is no type information
- Closed