My index.jade file(my button which the users clicks to delete the document) is:
a(href="/delete/#{booking.id}") Delete
So far in my index.js file is:
router.get('/delete/:id', function (req, res) {
Booking.findOneAndDelete({ id: req.params.id }).remove().exec();
});
I also, tried:
router.get('/delete/:id', function (req, res) {
Booking.findById(id, function (err, doc) {
if (err) {
message.type = 'Error!';
}
doc.remove(callback); //Removes the document
});
Neither are working, I just get the url with the ID:
localhost:3000/delete/54d49430b08883dc2fc8bb0d