我正在尝试检索填充此类的对象:
type Room struct {
Name string
People []Person
Chat []ChatMessage
Me Person
}
Run Code Online (Sandbox Code Playgroud)
数据字段"People"出现为空切片[].我使用简单的查找来获取数据.
result := Room{}
err = c.Find(bson.M{"name": "dev"}).One(&result)
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
弄清楚了....
答案可以在这里找到:https: //groups.google.com/d/msg/mgo-users/KirqfCSlKFc/t2l3l4yxFRwJ
基本上,只需要在People [] Person行的末尾添加'bson:""'
弄清楚了....
答案可以在这里找到:https://groups.google.com/d/msg/mgo-users/KirqfCSlKFc/t2l3l4yxFRwJ
基本上,只需要在People [] Person行的末尾添加'bson:""'
| 归档时间: |
|
| 查看次数: |
4768 次 |
| 最近记录: |