Reputation: 1462
I am planning to use Firestore as my database for an app that's about ordering and booking food and reservations in restaurants. So let's say I have restaurants, should I create a collection for each one of them OR a document for each one of them?
Upvotes: 0
Views: 32
Reputation: 317372
With Cloud Firestore, you generally do not use a collection to represent a unique thing. You generally use documents to represent a unique thing among a bunch of other similar things. This is what allows you to query for the things within that collection.
However, without knowing exactly what sorts of queries you intend to do, it's not possible to say what the right approach is. Effective NoSQL data modeling is dependent on know which queries you want to do ahead of time, then designing your data to suit those queries. I would recommend reading the documentation about queries before deciding how you should store your data.
Upvotes: 2