error: Cannot read properties of undefined (reading 'id') findByIdAndRemove works fine only findByIdAndUpdate show errors
app.post('/update',(res,req)=>{
User.findByIdAndUpdate(req.body.id,{
fname:req.body.fname,
lname:req.body.lname,
email:req.body.email,
password:req.body.password
})
.then(data=>{
console.log(data)
res.send("updated")
}).catch(err=>{
console.log(err)
})
})
app.post('/delete',(req,res)=>{
User.findByIdAndRemove(req.body.id)
.then(data=>{
console.log(data)
res.send("deleted")
}).catch(err=>{
console.log(err)
})
})