I'm taking a Nodejs course and I am following along.
I did write the same code as the instructor did and when I execute the code it gives me this error
Cannot read property 'id' of undefined
The error occurred when I tried to delete an item from a MongoDB database using the deleteOne method here is the code:
app.post('/delete-item',function(res,req){
db.collection('item').deleteOne({_id:new mongodb.ObjectId(req.body.id)},function(){
res.send("success")
})
})