I updated mongoose to latest version (6.0.2) and now I'm recieving this error and crush the application whenever .updateOne()
is executed. But object update inside the database. My code:
async(req,res) => {
await Todo.updateOne(
{_id : req.params.id},
{
$set : {
status : "inactive"
}
},
(updateError) => {
// if updateError exist
if (updateError) {
// print error
printError(updateError);
// response the error
res.status(500).json({
error : "There was a Server Side Error!"
});
} else {
// if error dose not exist
// print message
console.log("|===> ️ Data Was Updated successfully! ️ <====|\n");
// response success
res.json({
message : "Todo Was Update successfully!"
});
}
});
}