diff --git a/backend/controllers/productController.js b/backend/controllers/productController.js index d88963b..77fab8e 100644 --- a/backend/controllers/productController.js +++ b/backend/controllers/productController.js @@ -32,6 +32,7 @@ exports.newProduct = catchAsyncErrors(async (req, res, next) => { req.body.user = req.user.id; const product = await Product.create(req.body); + await product.save({ validateBeforeSave: false }); //Please add this line to your project otherwie admins are not bale to prodoucts into the database res.status(201).json({ success: true, @@ -253,4 +254,4 @@ exports.deleteReview = catchAsyncErrors(async (req, res, next) => { res.status(200).json({ success: true }) -}) \ No newline at end of file +})