I am currently making an expense manager app using firebase realtime database. My data on firebase looks like this :
{ Txns:[{s:"x", amount:1000 }
{x:"x", amount:2121 }
...
]
Balance: {total:2000(sum of all amounts in txns array)}
}
Now, i want to add all amounts in json array and store it in "balance:". So, should i use google cloud function for this, or i should do the calculation on client device? I know google cloud function is a smart approach but, every time a user enters json object will be added to the array, the google cloud function will run on every single entry updating the balance and google provides some limited reads and write in their free plan. So, should i worry about read write operation count or not ?