Relative Content

Tag Archive for node.jsmongodbexpressmongoosebackend

Why ain’t it updating the elements mongdb database?

products.map(async (prdct) => { try { let srchdPrdct = await ProductSchema.findById(prdct.product); let dscntPrice = Math.round( srchdPrdct.price * 83.49 * Math.round(100 – srchdPrdct.discountPercentage) ) / 100; if (srchdPrdct) { tempReceipt = await TempReceipt.findOneAndUpdate( { user: user._id, products: { $not: { $elemMatch: { product: srchdPrdct._id }, }, }, }, { $addToSet: { products: { product: srchdPrdct._id, quantity: […]