在猫鼬中更新数据时出现此错误
SyntaxError: JSON 输入意外结束
在 JSON.parse (
at parse
这是代码
exports.updateProduct = async(req, res, next) => { 让 product = await Product.findById(req.params.id);
if (!product) {
return res.status(500).json({
success: false,
message: "Product not found"
})
}
product = await Product.findByIdAndUpdate(req.params.id, req.body, {
new: true,
runValidators: true,
useFindAndModify: false
});
res.status(200).json({
success: true,
product
})
}
期待答案