【发布时间】:2020-05-27 03:33:29
【问题描述】:
尝试使用 mongoose 和 nodejs 更新 mongodb 中的值但不工作。我不知道该怎么做。如果有人知道,请帮助我找到解决方案。
data.controller.js:
module.exports.updateData = (req, res, next) => {
var uproducts = new updateProduct({
product_name: collectionDataJSON.product_name
});
updateProduct.updateOne({ p_id: thispid }, uproducts, function(err, raw) {
if (err) {
res.send(err);
}
res.send(raw);
});
}
【问题讨论】:
-
你有什么错误吗?
-
@Yousaf:不……没有得到
-
我在猫鼬中使用 findOne 和保存方法得到了解决方案