Mongoose查询仅返回id字段

时间:2018-01-11 19:02:37

标签: node.js mongodb

我正在尝试根据条件获取记录。

但我的查询只返回id而不是整个对象,为什么?

模型

productName

merchantName

postedDate

productStatus

查询

router.get('/underReview', function(req, res){
Products.find({merchantId: '5a3f781378cfc81a3c4c1cbd'}, {productstus:'Under Review'}, function(err, products){
    if (err){
      throw err;
    }else{
      console.log(products);
      res.json(products);
    }
  });
});

输出

[{"_id":"5a57ab9dc5e9d82a0ca71d0a"},{"_id":"5a57b0a3e26b842b2c4b560c"}]

0 个答案:

没有答案
相关问题