有的 document 包含某个 field,有的又不包含。 准备移除某个 collection 下所有 document 的某个 field,该怎么做?
走同样的路,发现不同的人生
mongo shell
db.foo.update({}, {$unset: {bar: true}}, {multi: true});
collection.update xxoo: $exists: true , $unset: xxoo: true , multi: true , ->
unset traversal removal. If there are too many entries, it will affect database performance, so be careful.
mongo shell
unset traversal removal.
If there are too many entries, it will affect database performance, so be careful.