I am trying to get an object populating this class:
type Room struct {
Name string
People []Person
Chat []ChatMessage
Me Person
}
The People data field appears as an empty fragment []. I use a simple find to get data.
result := Room{}
err = c.Find(bson.M{"name": "dev"}).One(&result)
What am I doing wrong?
Figured it out ....
The answer can be found here:
https://groups.google.com/d/msg/mgo-users/KirqfCSlKFc/t2l3l4yxFRwJ
Basically, you just need to add "bson:" "" at the end of the line People [] Person
source
share