Reputation: 19
I'm doing a small-scale school project where I need to 'create an app' that manages a list of contacts. I'm really new to Nodejs and mongodb and sadly I cannot find any answer in the internet.
I'm trying to delete a record from a document, by debugging I know that the data (id) is sent correctly to the server.
router.delete('/contact/:id', (req, res, next) => {
db.contacts.deleteOne
({_id: mongojs.ObjectId(req.params.id)
}).then(res => {
console.log('deleted ' + res);
res.status(200)
.json({message: 'Deletion successful! '})
});
});
Thank you very much :)
Upvotes: 0
Views: 98