It’s a common pattern that every developer has programmed — iterate across a dataset, and update each record. How can we do that with Cloud Functions?
A simple example is to set the
lastProcessed time with the current timestamp. Doing this in MySQL can be really simple
UPDATE userTable SET lastProcessed = NOW(); but how do we do it in Firebase?
An easy way to update a bunch of records is to fetch all records and update the
lastProcessed property via a loop.
This can become fairly intensive. If you have 20 users you’re going to make 21 requests…