router.get('/deleteRecord/delete/:id', function(req, res){
db.collection('inventories').remove({_id: mongodb.ObjectID( req.params.id)}, (err, result) => {
if (err) return console.log(err)
console.log('Welcome to Delete Function');
res.redirect('deleteRecord');
});
});
车把:Delete
获取ID,但记录并未被删除
答案 0 :(得分:0)
尝试
db.collection('inventories').find({_id: mongodb.ObjectID( req.params.id)}).remove()