I have a Firestore collection that contains documents with a subcollection.
The subcollection is intended to keep only one document that has information related to the parent document.
Collection - Document(parent) - Subcollection - Document(child) <-- (what ID??)
Since the parent document has become complex, I decided to refactor it into the structure shown above.
But I don't understand what ID is the best to give the child document.
Fixed ID or auto-generated ID or the parent document's ID?
What would you do when you have this kind of structure?
There is no objective best here, it all depends on the use-case and personal preference.
I typically call it something like DEFAULT
, but any other name is just as good. What I find most important is that I can remember it, since this is one document that you tend to type in your code.