I am trying to update the floor_num value from 1 to 9000 in an object in a nested array, in Mongoose:
thingSchema.findById(thingID, function(err, lm) {
if (!lm){
console.log(err);
}
else {
if (lm.style.maps.localMapArray){
for (var i = 0; i < lm.style.maps.localMapArray.length; i++) {
if (lm.style.maps.localMapArray[i].map_marker_viewID == req.body.map_marker_viewID) {
lm.style.maps.localMapArray[i].floor_num = 9000;
lm.save(function(err, landmark) {
if (err){
console.log('error');
}
else {
console.log('saved map updates');
}
});
}
}
}
});
But the data isn't being updated and there's no error being returned from Mongo
Aucun commentaire:
Enregistrer un commentaire