Unmarshalling typed structs that contain slices of typed structs fail
hokapoka opened this issue · comments
Hey there
I had been using gomongo for a while until I discovered that the Unmarshal for a complex typed struct which contains a slice of other typed structs fails
If you take the example I created here :
http://go.hokapoka.com/golang/mongodb-golang-gomongo/
type ExampleDoc struct {
Title string
Body string
Comments []Comment
}
type Comment struct{
Author string
Web string
Message string
}
When Unmarshalling the ExampleDoc the slice of Comments is empty.
It appears that this issue has been resolved by Daniel Smith over on bitbucket : https://bitbucket.org/lavalamp/gomongo
I've not had a chance to apply any fixes to this master branch, if anyone has the time I would love to see the fix merged into this project.
Many thanks.
Andy
I think I may have fixed it, would you mind trying your code out with the latest version?
That works great, many thanks.