如何删除猫鼬对象

时间:2019-12-25 01:27:52

标签: node.js mongoose

我使用findByIdAndRemove()查找我的数据,但不是删除整个对象而是显示

_id: id_number,
imagePath: null,
description: null,
title: null,
price: null

这是我的删除路线

router.delete('/admin/products/:id', function(req, res){
  Product.findByIdAndRemove(req.body.id, (err, product) => {
    // check if query error

  });
});
数据库中的

 我要删除整个对象。

0 个答案:

没有答案