dalenguyen / firestore-import-export

An application that can help you to backup and restore from Cloud Firestore | Firebase
https://www.npmjs.com/package/firestore-export-import
401 stars 109 forks source link

sync like feature? #26

Open Prathik-Jain opened 4 years ago

Prathik-Jain commented 4 years ago

Is it possible to add a feature where I run firestore-import-export as a cronjob, So that it reads only what is changed since the last update and update the file with the same documents? Instead of reading the thousands of documents each time I run it.

dimoreira commented 3 years ago

@Prathik-Jain I think the best solution for this is to run your firestore-import-export as a Firebase Cloud Function to listen for changes in the collections and export a new file with changes (or update an already created file).

Prathik-Jain commented 3 years ago

@dimoreira It might be a solution for smaller data stores, which do not update frequently. It might get pretty expensive quickly, otherwise.

dimoreira commented 3 years ago

@Prathik-Jain The free-tier for the Firebase Cloud Functions is pretty big. If you listen for insertions / changes at each document that get added / updated, you can update some kind of batch file on Cloud Storage that can be read from time to time by a cron **cloud function** to generate the new file based on the saved / batched.

Makes sense?