我想只是把對象爲對象的數組中的mongodbMongoDb:如何將附加對象插入到golang中的對象集合中?
{
"_id" : ObjectId("51c9cf2b206dfb73d666ae07"),
"firstName" : "john",
"lastName" : "smith",
"ownerEmail" : "[email protected]",
"camps" : [
{
"name" : "cubs-killeen",
"location" : "killeen"
},
{
"name" : "cubs-temple",
"location" : "temple"
}
],
"instructors" : [
{
"firstName" : "joe",
"lastName" : "black"
},
{
"firstName" : "will",
"lastName" : "smith"
}
]
}
和推對象到需要上述文件做
db.stack.update({"ownerEmail":"[email protected]"},
{$push: {
"camps":{ "name":"cubs-killeen","location":"some other Place" }
}
}
)
所以,我怎麼能使用氧化鎂實現相同的功能驅動程序
有沒有必要[標題前加問題標籤](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles),請編輯標題。另外,請不要濫用** bold **標記。 –