Here is the piece of code that is trying to fetch all the docs from the mongodb.
func fetchAll(db *mgo.Database) map[string]interface {
var msg map[string]interface{}
err := db.C("msg").Find(nil).All(&msg)
if err != nil {
panic(err)
}
return msg
}
I got the error: syntax error: unexpected var
What is wrong here? And is there a better way to fetch the arbitrary mongo docs via mgo?
thanks