我正在尝试更新mongoose中的对象:
Category.findByIdAndUpdate(product.category, {
$addToSet: {
products: product
}
}, function(err) {
if (!err) {
req.flash('success', 'Successfully updated')
return res.redirect('back')
} else {
console.log("Error var" + err);
res.render('products/edit', {
title: 'Edit Product',
product: product,
errors: err.errors
})
}
})
而我'我得到以下错误:
./node_modules/mongoose/lib/utils.js:413
throw err;
^
RangeError: Maximum call stack size exceeded
我哪里错了?