Answers for "mongodb find and remove"

0

delete in mongodb

//To delete all documents
db.movies.deleteMany({})
//Delete All Documents that Match a Condition
db.movies.deleteMany( { title: "Titanic" } )
//Delete Only One Document that Matches a Condition
db.movies.deleteOne( { cast: "Brad Pitt" } )
Posted by: Guest on June-16-2022
0

find All and delete in mongodb

db.products.remove( { qty: { $gt: 20 } } )
Posted by: Guest on January-29-2021

Browse Popular Code Answers by Language