【发布时间】:2016-04-08 22:20:39
【问题描述】:
假设您的收藏中有以下文档:
{foo:[{
bar1:{_id:1, active: true},
bar2:{_id:2, active: true}
},{}]
}
查询:
db.test.update({$or: [
{'foo.bar1._id': 1)},
{'foo.bar2._id': 1}
]
},
{$set: {'foo.?????.active': false}})
结果:
{foo:[{
bar1:{_id:1, active: false},
bar2:{_id:2, active: true}
},{}]
}
【问题讨论】:
标签: arrays mongodb mongodb-query mongo-shell