-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Nonexisiting parents should not be created after export/import #869
Comments
Why need to keep that orphan child collection? |
@cuong0993 ok got you, firebase does distinguish them somehow thoughm, specifically in their admin UI. I guess it should be possible to store a flag inside of that empty json and then skip creation of such docs/collections on import. As to why, I've described my use case above, I basically store counter for the number of clients inside of the clients collection. |
Maybe you can change this line to check if documentData is empty the skip set document (all empty documents will be not existed) https://github.com/cuong0993/node-firestore-import-export/blob/7b98376476b3b70eb0609577e837342dec2a24ef/src/lib/import.ts#L89 |
@cuong0993 thanks bro! I'll give it a try |
Context:
Firestore has a concept of "non-exisitng" nodes in path
For example "collection/nonexsitingdoc/subcollection/doc1"
It's possible to create a doc1 where "nonexsitingdoc" will not existing - in such case firestore UI in browser shows it as greyed out.
Expected behavior
Library doesn't create "nonexsisting" docs after export/import
Actual behavior
Library creates docs that are "nonexsisting" after export/import
Steps to reproduce the behavior
"collection/nonexsitingdoc/subcollection/doc1"
My usecase
I have a collection of client with the counter in production like this:
Clients:
users/{userId}/clients
Client counter:
users/{userId}/clients/-counter-doc-/-conter-col-/counter
Both
-counter-doc-
and-conter-col-
don't exisit in the database which is expectedBut after exporting and importing to the dev project (for debug and troubleshooting) the lib creates both
-counter-doc-
and-conter-col-
Now when I fetch client list it also returns
-conter-col-
document as a client which breaks the internal logic.The text was updated successfully, but these errors were encountered: