// DELETE
// DELETEONE
User.deleteOne({name:"adam"}).then((res)=>{
console.log(res);
})
.catch((err)=>{
console.log(err);
// DELETE MANY
User.deleteMany({age:20}).then((res)=>{
console.log(res);
})
.catch((err)=>{
console.log(err);
// FindOneAndDelete
User.findOneAndDelete({ name: "bruce" })
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
// FindByIdAndDelete
User.findByIdAndDelete("67c1579265226d7cb73e3d72").then((res)=>{
console.log(res);
})
.catch((err)=>{
console.log(err);
Comments
Post a Comment