I have a data structure, like so
{
_id: '',
name: 'A',
financialReports: {
monthlyBill: 20,
monthlyBillReports: [
{
month: 'JAN',
isPaid: true
},
{
month: 'FEB',
isPaid: false
},
{
month: 'MAR',
isPaid: false
},
{
month: 'APR',
isPaid: false
},
...
]
}
},
...
How should I dynamically update financialReports.monthlyBillReports[i].isPaid to true? I got array of data that indicate to month field in Database from front-end ['FEB', 'APR'], But I am not sure if I could iterate over the array and make update query to Database.