Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup fails for subcollections unless document exists for parent document #40

Open
Venryx opened this issue Jul 27, 2018 · 1 comment

Comments

@Venryx
Copy link

Venryx commented Jul 27, 2018

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.

@kitfit-dave
Copy link

kitfit-dave commented Nov 21, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants