Delete Methods
MongoDB provides the following methods to delete documents of a collection:
db.collection.remove({}) | Delete a single document or all documents that match a specified filter. |
db.collection.deleteOne({}) | Delete at most a single document that match a specified filter even though multiple documents may match the specified filter. |
db.collection.deleteMany({}) | Delete all documents that match a specified filter. |
db.users.deleteOne( { status: "D" } )
db.getCollection('Users').find({$and:[{"cid":2}, {"created-at":{ "$gte" : new ISODate("2018-01-22")}} ]})
No comments:
Post a Comment