dalenguyen / firestore-backup-restore

NPM package for backup and restore Firebase Firestore

Home Page:https://firebaseopensource.com/projects/dalenguyen/firestore-backup-restore/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ony one subcollection get export from backup method

burhankhanzada opened this issue · comments

i think the problem is with this line because this overwrite the extisting data so the last sub collection is only printed
data[collectionName][doc.id]['subCollection'] = subColData;

or is there is something wrong with my code

firestoreService
  .backup('collection-name')
  .then((data) => { 

    let json = JSON.stringify(data, null, 2);
      
      console.log(json)
      
      fs.writeFileSync('backup.json', json);

  });

I created a pull request fixing this.

Should be fixed in v0.6.1