-
Type:
Task
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
None
-
None
-
None
-
None
-
None
-
None
EDIT: The resolution for this ticket is that we should document that unmarshalling into a struct that has a field with type interface{} yields a bson.D. This differs from mgo, which defaulted to bson.M.
if we have a struct like
type Something struct {
Val []interface `bson="val"`
}
In our case this struct is an array of objects. It was actually just a draftJS block. in JSON it would look like this, and this is what it would look like after being inserted into mongo
[{
"entityRanges" : [ ],
"inlineStyleRanges" : [ ],
"key" : "fb86k",
"text" : "",
"type" : "unstyled"
}]
the mongo driver marshalled this perfectly into the database. No issues there. However when pulling the data out, we receive
[
{Key: "entityRanges", Value: [ ]},
{Key: "inlineStyleRanges", Value: [ ]},
{Key: "key", Value: "fb86k"},
{Key: "type", Value: "unstyled"},
]
this doesn't reflect the data in the database and actually makes no sense why mongo decided to break up the object like this
- is related to
-
GODRIVER-2766 Fail to retrieve a document with a map[primitive.ObjectID]interface{} field
-
- Closed
-