Reputation: 885
As I can see Cloud Firestore and it's collections give us much more power to organize data. For me and many others, I think, there's a basic question.
What's the better approache to store a master detail relation?
Like this : a "CARS" collection with documents that have a "MAKE" property.
I think that I need a "CARS" collection and an independent collection for "MAKES".
Any thoughts ?
Upvotes: 1
Views: 705
Reputation: 42008
Unless you have a specific need, you might be better off just have MAKE as a field each CARS document so you can query for it.
If you want to control MAKE as an enumerated field, you can create a collection called ValidMakes that has documents with ids of all the allowed Makes. In security rules, check that there exists a document with the same id as the MAKE field's value before allowing the write.
Upvotes: 4