Being new to the MERN technology, I've been bothered by this warning for quite some time now: "DeprecationWarning: Mongoose: findOneAndUpdate()
and findOneAndDelete()
without the useFindAndModify
option set to false are deprecated."
But I'm not using either of these functions.
router.delete('/:id', (req, res)=> {
Category.findByIdAndRemove(req.params.id).then(category => {
if(category){
return res.status(200).json({success: true, message: ' The category is deleted...'})
} else {
return res.status(404).json({success: false, message: " Category not found..."})
}
}).catch(err=>{
return res.status(404).json({success: false, error: err})
})
})
This warning pops up when I try to use the Delete method on Postman...