我举了这个例子:
db.inventory.update( { tags: { $nin: [ "appliances", "school" ] } }, { $set: { sale: false } } )
形成 mongodb.org 网站。
每当我尝试多次使用 $nin 时, find_and_modify 都会失败。我想实现的目标:
db.inventory.update( { tags: { $nin: [ "appliances", "school" ]}, owners: {$nin : ["a","b"] }, { $set: { sale: false } } )
但似乎我不允许多次使用 $nin 。我知道 $push 不能这样使用,所以我只在多个字段上使用 $push 一次。但是如何将它用于$nin?