I want just push object into array of objects in mongodb
{
"_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"
}
]
}
and to push object into above document in need to do
db.stack.update({"ownerEmail":"[email protected]"},
{$push: {
"camps":{ "name":"cubs-killeen","location":"some other Place" }
}
}
)
So how can i implement same functionality using mgo driver