The Android sample app for Cloud Firestore has database structure as shown below:
Now consider a situation in which the first restaurant has very large number of ratings (Here ratings is a collection along with other documents in the first restaurant's id) and I just want to show basic details of all the Restaurants like name and city.
I would accomplish this by creating a reference as shown below:
mRestaurantRef = mFirestore.collection("restaurants").document(restaurantId);
I have following questions regarding this:
- Is this the right way to do because I am getting a document snapshot which also includes ratings collection which I don't need for now as it can decrease the loading speed?
- Should I change the firestore database structure as we do in firebase realtime database and flatten it?
