1
我有類似...錯誤/ MGO
type Item struct {
Name string `json:"name" bson:"name"`
Config map[string]interface{} `json:"config" bson:"config,inline"`
}
func (repository *ItemRepository) UpdateConfig(id string, config map[string]interface{}) {
change := mgo.Change{
Update: bson.M{"$set": bson.M{
"config": config,
}},
},
}
但我得到一個錯誤Raw Unmarshal can't deal with struct values. Use a pointer.
。我不完全確定這意味着什麼,或者期望的是什麼。是否可以將「鬆散」數據作爲子文檔存儲?
使用'config'的指針而不是'config'本身 –
仍然有同樣的錯誤@simon_xia –