Initially, When i started to have a look at this, the storage was at 2.2Gb. You can see that in the Before Storage Graph in the left-bottom image. That seemed to be high, i know why and which node in the firebase RTDB contributed to it. So basically my idea is to download all the data in that down and cleared it down.
Failed attempts are
Export options. Failed to work as from a single location you cannot export data exceeding 256 MB.
V1 - Since i had the keys, programmatically tried to retreive data via NodeJS and approach used is and got the below error.
Using .every() loop method and pushing promises to array
Using bluebird Promise.map to process the promises with concurrency(2)
Successful approach that worked is,
Created an outer loop using .slice() so that rest of the program processes around 10 chunks
Using .every() loop method and pushing promises to array
Using bluebird Promise.map to process the promises with concurrency 2
Below is the code,
After doing this, still there were more data and keys of those i didn’t have and this is where Firebase Database REST API came to help.
By executing this command, i got just the keys without the data underlying it, thats the shallow trick.
shallow : This is an advanced feature, designed to help you work with large datasets without needing to download everything. Set this to true to limit the depth of the data returned at a location. If the data at the location is a JSON primitive (string, number or boolean), its value will simply be returned. If the data snapshot at the location is a JSON object, the values for each key will be truncated to true.
Plan for future clean-ups is to incorporate the firebase rest api into the above program like,
Execute the Firebase REST API with Shallow via nodejs and retreive the keys
Create an outer loop using .slice() so that rest of the program processes around 10 chunks
Using .every() loop method and pushing promises to array
Using bluebird Promise.map to process the promises with concurrency 2
Why in the first place ended up in this activity
Assumption, i will be able to retreive using program or export via firebase feature
Didn’t plan for archieving or decommissioning while creating it initially.