Change the field value in Firestore automatically after a certain time [closed]

Tags: , , ,



I’m working on Javascript and here’s how’s my data looks like.
Here the ss of my firestore

I want the functionality where after every 24 hours, my stateChanges fields updates to 0. (see the circled field).
Any help would be appreciated.

Answer

There is no such functionality built-in in Firestore.

A possilbe solution would be to use an HTTP Cloud Function which will alternate state and invoke it with a Cloud Scheduler cron job every 24 hours.



Source: stackoverflow