|
At my struct have a sub level of document example
type ( A struct { ID primitive.ObjectID `bson:"_id,omitempty"` Title string `bson:"title" } B struct { ID primitive.ObjectID `bson:"_id,omitempty"` Title string `bson:"title" } C struct { A Bs []B `bson:"b"` })
|
when fetch data and decode data to struct C all of field return nil or empty
but if i setup struct have all of field such as
type (
|
C struct {
|
ID primitive.ObjectID `bson:"_id,omitempty"`
|
Title string `bson:"title"
|
Bs []struct{
|
ID primitive.ObjectID `bson:"_id,omitempty"`
|
Title string `bson:"title"
|
} `bson:"b"`
|
}
|
)
|
data return correctly
how to fix this problem or this is bug?
thank you.
|