In the document below, I have an array called imAccounts. I want to update() the object in that array. How can I do that?
{
"_id" : ObjectId("503c55da1c192a530b000001"),
"imAccounts" : [
{
"accountType" : "Windows",
"accountName" : "rwqerqw",
"accountPassword" : "erqwerwe"
},
{
"accountType" : "Yahoo",
"accountName" : "rwqerqw",
"accountPassword" : "erqwerwe"
}]
}
With this document structure you can update an object in the array using the positional operator ($):
Note that the positional operator currently only applies to the first matched item in the query.