title: Is this structure a good practice to query for restaurants?
body: <p>I have a top collection called categories, inside this collection, there are documents that are my categories, one of those documents is, for example, a restaurant. </p>
  
  <p>That restaurant document has these values:</p>
  
  <p><code>name</code> , <code>image</code> and <code>subcollectionId</code></p>
  
  <p>so, when I query to get all my categories from the top collection, I get those attributes for everyone, so, in my other screen, now I can refer to the subcollection of restaurants to get all the restaurants of that category</p>
  
  <p>For example, if I need to get all the restaurants after clicking the restaurant category, I will need to do something like this</p>
  
  <pre><code>db.collection("categories").document(restaurantCategoryId).collection(subcollectionId).get()
  </code></pre>
  
  <p>Now, I need to use this query in my other view, to query for all the restaurants inside that category, and I wonder if this schema for doing this is good or it can be done easier</p>
  
  <p>So I decided to do this structure</p>
  
  <p><a href="https://i.stack.imgur.com/htadE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/htadE.png" alt="enter image description here"></a></p>
  
  <p>Let me know if I need to change something or I doing this in another way</p>
  
  <p>To put more in context, I first query all the categories</p>
  
  <pre><code>db.collection("categories").get()
  </code></pre>
  
  <p>Then I display all the categories with its attributes (in this case just name and image) and then in my other view after clicking this category I run this query to get all the restaurants from that category document subcollection</p>
  
  <pre><code>db.collection("categories").document(restaurantCategoryId).collection(subcollectionId).get()
  </code></pre>
  
  <p>So, I don't know if I'm wasting reads with this query, or if its a good approach, since I just show to the user all the categories but without all the category list data if they don't click it, after they click that category, I load all the documents from that category</p>