Answers for "delete with objectid mongo cli"

Go
2

mongodb command remove by _id

db.test_users.deleteOne( {"_id": ObjectId("4d512b45cc9374271b02ec4f")});
Posted by: Guest on August-16-2021
1

MongoDb delete

1	db.coll.remove({name: "Max"})
2	db.coll.remove({name: "Max"}, {justOne: true})
3	db.coll.remove({}) // WARNING! Deletes all the docs but not the collection itself and its index definitions
4	db.coll.remove({name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
5	db.coll.findOneAndDelete({"name": "Max"})
Posted by: Guest on January-01-2022

Browse Popular Code Answers by Language