I have this document in mongodb.
I want to update the PENDING status to ORDER PLACED. How do I do that?
I am try with this but not working. First I am finding the document by ordered then update it.
for (let item in orderedProducts) {
await db.collection("orders").updateOne(
{ order_id: parseInt(myrequest.orderId) },
{
$set: {
`ordered_products.${item}.orderStatus`: "Order Placed"
}
})}