I want to update nested array in Mongo DB (using Node.js). I am able to get the array index location.
How can I update same ? I am facing some problem while using escape character in $set
Here is what I am doing :
testCollection.update({
"uniqueID": someID,
"topLevelObject.innerObjectValue": innerObjectVal
}, {
$set: {
'array.' + outerArrayIndex + '.value': updatedValue,
}
}, function(err, result) {
if (err) {
console.log("Error occurred while updating db info");
}
}
);