I want to automatically update a child value in firebase database, monthly.. How can I handle this?
-
This question has been asked a lot here on SO. Search for [firebase]cron to get some initial ideas. – Jay Feb 10 '19 at 23:28
2 Answers
There is nothing built into the Firebase Realtime Database to automatically update values periodically. So you will have to write the code for this yourself.
After you write the code you will need to run that code periodically.
If you put the code into the app, you can run it periodically there. It's technically possibly, but a bit involved (is the app running all the time?, what if multiple users run it?, etc).
So the more common approach is to run that code on a server. If you don't have a server yet, you can run the code in Cloud Functions for Firebase, which allows you to run small pieces of (for now only JavaScript or TypeScript) code on Google's servers. To trigger this code to run monthly, see Cloud Functions for Firebase trigger on time?

- 565,676
- 79
- 828
- 807
There is nothing fully integrated at the moment. One way would be to use a Google Cloud scheduler job that will start your process in a Google Cloud function once a month. You will only pay once a month for the duration of your function.
You can have an example here

- 36
- 2