Open Venryx opened 6 years ago
Just bumped into this myself. It seems to be that the firestore api does not (yet) have any function to list collections with no document. The low level api has listCollections that can take showMissing arg that makes it return all collections including those with no document, but it is not exposed to us. (Incidentally, it looks like jskeet has just added that functionality (in the dotnet api)). Not sure if it is on the roadmap for us, but from what you hear there is lots of "querying" stuff that is coming "real soon now".
FWIW, what I will be doing for our backup is (for now) making a (useless) doc at each path node so that the backup script can traverse in.
(edit:) Well... actually... it looks like it does. See PR below.
My database is set up like this:
-versions --v1 ---tasks ----task1 ----task2
I tried creating a backup of my database, however, it fails -- that is, it creates the "v1/tasks" folder, but it's left empty.
I figured this might be because the "v1/tasks" path is just an empty container -- there is no actual document at that location.
To fix it, I tried creating a document (with a meaningless field) at "versions/v1". As expected, the backup then succeeded. (because then this code was able to run: https://github.com/willhlaw/node-firestore-backup-restore/blob/master/index.js#L187)
It would be nice if the library did not require a "placeholder" document for the subcollections under a path to be able to be backed up.