如果特定欄位是特定值,則刪除記錄
db.posts.find().forEach(function(doc){
if(doc.foo === 'bar'){
db.posts.remove({_id: doc._id});
}
});
db.posts.find().forEach(function(doc){
if(doc.foo === 'bar'){
db.posts.remove({_id: doc._id});
}
});