I have a collection of Product, the client post and Order request with an array of objects every single object contains the _id product (objectId) and the quantity he bought.
[
{producId: "dshsdsdh72382377923",
quantity: 20
},
{producId: "dsh673sdh72382377923",
quantity: 10
},
{producId: "hjddjkdjkdj676372373",
quantity: 5
},
]
I want to query the Product Collection and decrement (Update) the numberInStock of every product with the quantity that the client bought ! How can i do it ?