I have a Firestore database that consists of records with an "endDate" field. Based on this field I want to delete some records once a day and run a cron job for them. For example, if today is November 22, 2023 and the end date is November 21, 2023, I want that record to be removed from the database. How can I achieve this? Thank you
2
Answers
You can create a firebase cloud function that for example runs Node.js code everyday at 0:00.
"0 0 * * *" is a cron expression, examples
One job lies way in the capacity of cloud functions’ free tier too.
You can leverage Firestore’s Time-To-Live feature to have the system automatically remove "stale" documents.