你近了
您应该在使用
$update运算符时使用点符号来做到这一点:
Person.update({'items.id': 2}, {'$set': { 'items.$.name': 'updated item2', 'items.$.value': 'two updated'}}, function(err) { ...
你近了
您应该在使用
$update运算符时使用点符号来做到这一点:
Person.update({'items.id': 2}, {'$set': { 'items.$.name': 'updated item2', 'items.$.value': 'two updated'}}, function(err) { ...