尝试从数据库中删除文档时收到此错误:
无法获取 /delete/532fa5e56f885c7fec5223b1fds
如何成功删除文档?
应用程序.js
//Delete
app.del('/delete/:id', routes.delete_offer);
路线/index.js
//Delete
exports.delete_offer = function (req,res){
Offer.findOneAndRemove({'_id' : req.params.id}, function (err,offer){
res.redirect('/newsfeed');
});
};
意见/仪表板.jade
- each offer in offers
div.offer.row
a(href="/offer/" + offer._id)
div.columns
div.sell_type
p=offer.type
div.small-8.columns.sell_info
p.sell_price="$" + offer.fixedPrice() + " "
p.sell_location="@ " + offer.location + " ›"
div.small-4.columns.sell_pic
p=offer.user_id
a.delete(href="/delete/" + offer._id)="Delete Offer"