Initially I found firestore appealing because it lets you organize your data hierarchically, and this matches more closely how my data behaves in the real world. However while, yes, nominally firestore lets you organize data hierarchically, functionally it is almost the same as storing everything in big flat collections:
- If you delete a document it doesn’t delete its sub collections and documents recursively.
- You can’t easily move an entire subtree of the data from one place to another, you have to recursively move each subdocument manually.
This is functionally equal to (or worse than, respectively) storing all your documents of the same type in one big collection and manually adding references to the ID of the parent document. Among other disadvantages such as having to use collection group queries, with their quirks and limitations, if you want to query all the documents.
The only real advantage that I saw cited for storing data hierarchically in firestore is that:
- If you filter your single-parent query by a single field then you don’t need to build a composite index because one-field indices come for free with each collection.
What are other objective advantages?