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

Investigate support and need of backing up disabled Documents #13

Open
yoiang opened this issue Dec 19, 2017 · 5 comments
Open

Investigate support and need of backing up disabled Documents #13

yoiang opened this issue Dec 19, 2017 · 5 comments

Comments

@yoiang
Copy link
Member

yoiang commented Dec 19, 2017

Brought to attention by @ropaolle in #12

  1. Is it possible, ie does the SDK support it?
  2. Why do people use disabled documents?
  3. When they use them why do they need them backed up?
@ropaolle
Copy link

Added an example of how I created empty docs. Maybe I do something that don't make sence,

  1. It can be done from the Web Client, se below.
  2. Not sure you need to. However, deleting fields in the parent doc may lead to "unknown" empty docs even if you are not aware of it.

Example

export const database = firebase.firestore();

// Create an empty document with a collection (is not backup'ed)
database.collection('coll-a/doc-a/coll-b').doc().set({ item1: '1', item2: '2' });

// Creates a non-empty document with a collection (is backup'ed). However, if you delete itemX we get an empty document again.
database.collection('coll-a').doc('doc-b').set({ itemX: 'x' });
database.collection('coll-a/doc-b/coll-b').doc('doc-b').set({ item1: '1', item2: '2' });

@jeremylorino
Copy link
Contributor

@ropaolle do you have a real-world use case?

I have a few empty collections that I must have preserved but I have yet to run into a case where an empty document arises.

@ropaolle
Copy link

ropaolle commented Feb 4, 2018

@jeremylorino not sure I understand your question. The problem I got was that a doc with only one collection as a child was not backed up. My workaround was to move the collection to the root.

@jeremylorino
Copy link
Contributor

Ok, I misunderstood the original question.

Re-read you last comment and I understand now. And regardless of a real world usecase these documents should still be backed up; empty/dangling or not.

Gotcha!

@jeremylorino
Copy link
Contributor

Firestore api supports showing missing docs in a ListRequest

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

No branches or pull requests

3 participants