【发布时间】:2019-12-18 23:58:02
【问题描述】:
我有如下数据。
// first document
{
"id": 1,
"exist": true
}
// second document
{
"id": 2,
"exist": false
}
// third document
{
"id": 3,
"exist": false
}
当我 findOneAndUpdate({_id:2}),{exist:true}) 时,我希望 'id:1' 的存在在一个使用聚合等的查询中自动更改为 false。
你能推荐一些想法吗?非常感谢您阅读我的问题。
【问题讨论】:
-
请避免垃圾邮件问题。几小时前你已经问过了How to update each value with one query in mongodb