我的json in db like this =
_id:21321213123, // req.body.analizId
updatedAt:...,
createdAt:...,
uploadedPhotos: [
{
photoId:12321311,
isDeleted: false
},
...
]
我的查询是
update({_id: req.body.analizId, "uploadedPhotos.photoId":req.body.id}, {$set:{"uploadedPhotos.$.isDeleted":true}}).exec(function(err, d){ console.log(d)});
我想更新uploadPhotos关联中的isDeleted字段,以及uploadPhotos数组中匹配的photoId 但代码不起作用 我怎么能这样做?