0
我在本地的MongoDB以下文件:匹配結構MGO結果
_id 25dd9d29-efd5-4b4e-8af0-360c49fdba31
name Reykjavik
initialDiseaseColouring blue
在我的代碼我建立了一個城市的結構如下:
type City struct {
ID bson.ObjectId `bson:"_id,omitempty"`
Name string
InitialDiseaseColouring string
}
我查詢它使用
result := City{}
collection.Find(bson.M{"name":"Reykjavik"}).One(&result)
當我嘗試訪問initialDiseaseColouring
屬性它的不存在
這是結果,當我打印:
{ObjectIdHex("32356464396432392d656664352d346234652d386166302d333630633439666462613331") Reykjavik }
有誰知道爲什麼嗎?
我下面就https://gist.github.com/border/3489566