In-Class exercise: Firestore DB design

We'll be working with a Yelp clone named FriendlyEats (a Firestore starter app) :

picture of Friendly Eats Yelp clone

Your goal is to design a data model for this application.

  1. Try out the app at https://yelp-clone-5208e.web.app/. Add reviews, and try changing the filtering and sorting.
  2. What top-level collection(s) will you have?
  3. What will the document for "Place Place" contain (fields and values)?
  4. Does this document contain any subcollections? If so, what are they? What are the fields and values of a document in that subcollection?
  5. Assume the following:
    1. What sort of a data model would require retrieving 96 documents (on average) to display the initial app page?
    2. Can you redesign the documents so that you only have to retrieve 6 documents?
    3. Before the redesign, what needs to happen if a new review is added?
    4. After the redesign, what needs to happen if a new review is added?
  6. What index(es) are needed in order to support the the following filters:
    1. Brunch places located anywhere with any price sorted by rating:
    2. Brunch places located anywhere with any price sorted by # of reviews:
    3. Brunch places located in Atlanta with any price sorted by # of reviews: