my db model looks like this
\"clientId\":\"123456\"
\"devices\" :
[{
\"deviceId\" : \"123\",
\"deviceType\" : \"ios\",
\"notificat
You're looking for a typical positional operator case:
db.coll.update
(
{
"clientId":"123456","devices.deviceId":"321"
},
{
$set:
{
"devices.$.deviceType":"kindle","devices.$.notification":"false"
}
}
)
You need to update an element matched inside an array, $ does this for you, so you can find a document with a specific element inside of an array and "remember" with the positional operator $ which one you matched to update it.