2

I use the firebase realtime database to store user information.

Here is a picture of the database: screenshot of the database

How can I reset the value "nombre_dons_day" for all the users each day at 00:00 using firebase fonctions ?

Thank you in advance for your help

Delphin
  • 33
  • 5
  • One approach could be using the cron-job website to trigger your http function each day at that time, but that service maybe is not that stable as it should – Gastón Saillén Dec 28 '18 at 20:34

1 Answers1

1

You HAVE to use something other than Firebase cloud functions as a trigger... whether that's a 3rd-party chron job service, that's up to you. This Firebase article addresses this issue and walks you through doing it with Google's App Engine... but whether you choose to use a Google-backed solution or a well known 3rd-party service is up to you.

The cron job should call/trigger your cloud function... and in your case, the cloud function should loop over all of the users in that database table and reset (or add 1 to) the "nombre_dons_day" field.

JeremyW
  • 5,157
  • 6
  • 29
  • 30