Mongoose find()具有多个值
我试图通过使用thisCart数组从产品集合中找到()多个ID,该数组还有一些我要比较的ID。我尝试了几种方法,但没有成功。
cart.findOne({"user_id": userId, "activeCart": true}).then(thisCart => {
Product.find({"product_id": prodId})
// here thisCart bring back arrays with multi ids
// which I want to do foreach thisCart[i].id = Product.product_id
// and eventually get all the products which equal to thisCart[i].id
res.status(200).json({
});
回答如下: