firestore-migrator icon indicating copy to clipboard operation
firestore-migrator copied to clipboard

Batch deletes of a collection

Open SogoGolf opened this issue 6 years ago • 3 comments

hi there, first a huge thank you for this great migrator lib. Has been massive time saver.

Is it possible to use firestore-migrator to do a batch delete of a collection, prior to running it for an upload ?

or is there a flag i can set so that if i re-run an upload to a collection, it will overwrite, not append the data (documents) to the collection ?

SogoGolf avatar Oct 08 '18 22:10 SogoGolf

Good point, as it is now uploaded documents replace existing ones with the same ID, and there's the --merge option. But there's no way to prune excess documents or delete an entire collection prior to import - analogous to sql's TRUNCATE TABLE.

Have you thought of the best way to implement such a feature? Should we use a flag per collection, or every collection imported. Or perhaps a new cli option, such as --truncate path/to/collection.

stildalf avatar Oct 09 '18 06:10 stildalf

i think a command line argument would be perfect. for example:

fire-migrate import --replace test.INDEX.csv myCollection

SogoGolf avatar Oct 10 '18 05:10 SogoGolf

if this is already fixed for, can someone close this ticket, I think it's important to keep this tidy to not give the wrong impression to people looking around this lib

samiq avatar Dec 12 '18 11:12 samiq