1Person.update(
2 {
3 _id: 5,
4 grades: { $elemMatch: { grade: { $lte: 90 }, mean: { $gt: 80 } } }
5 },
6 { $set: { "grades.$.std" : 6 } }
7)
1Person.findOneAndUpdate({_id: id},
2{
3 "$set": {[`items.$[outer].${propertyName}`]: value}
4},
5{
6 "arrayFilters": [{ "outer.id": itemId }]
7},
8function(err, response) {
9 ...
10})
11