Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 updateMany 命令在一个集合中更新 Mongodb,条件是 6 到 10 个用户已经更新,我需要排除 6 个用户数据应注意更改的条件,其他 300 个用户将更新。
使用$nin
字段值不在指定的数组中或字段不存在。
db.Users.updateMany( { _id: { $nin: [ "id1", "id2" ] } }, //query filter { } //update )