Hi there, I want to update every sub-element in sub of sub-array
This is my Schema:
{
"items": [
{
"product": "63c66986e9e1ab5801914215"
"variant": "63c66986e9e1ab5801914216",
"locations": [
{
"quantity": 1,
"location": "63c66733e3e9f11b2e8f8947"
}
],
},
{
"product": "63c66776a6d77f32e2776c63",
"variant": null,
"locations": [
{
"quantity": 6,
"location": "63c66733e3e9f11b2e8f8947",
},
{
"quantity": 7,
"location": "63c66733e3e9f11b2e8f8948",
}
]
}
],
"paymentStatus": "PAID",
"fulfilledStatus": "PARTIALLY-FULFILLED",
"orderId": "O-001",
}
So here I want to add a new field “fulfilledStatus” in the locations array for every item in the items array that got the location = “63c66733e3e9f11b2e8f8947”
so the items should like this after update
"items": [
{
"product": "63c66986e9e1ab5801914215"
"variant": "63c66986e9e1ab5801914216",
"locations": [
{
"quantity": 1,
"location": "63c66733e3e9f11b2e8f8947",
"fulfilledStatus": "FULFILLED"
}
],
},
{
"product": {
"63c66776a6d77f32e2776c63"
},
"variant": null,
"locations": [
{
"quantity": 6,
"location": "63c66733e3e9f11b2e8f8947",
"fulfilledStatus": "FULFILLED"
},
{
"quantity": 7,
"location": "63c66733e3e9f11b2e8f8948",
}
]
}
]
How can i do that