###文档如下:
{
name: 4,
list: [{
id: "a",
date: 1504195200000,
other: "c"
},{
id: "b",
date: 1504195200000,
other: "c"
}]
}
如何把list数组下的元素里的other全部一次性更新呢? 尝试了以下方法:不行…
db.getCollection('test').update({'name': 4}, {$set: {'list.$.other': 'a'}}, {multi: true})
不知道为什么?求大神的解决方法,谢谢