title: combining multiple collection group queries
body: <p>I have set up a firebase database like such:</p>
  <pre><code>food (collection)
    - 10/19/2021 (document)
       - Breakfast (collection)
         - Food Item 1 (document)
       - Lunch (collection)
         - Food Item 1 (document)
       - Dinner (collection)
         - Food Item 1 (document)
    - 10/20/2021 (document)
       - Breakfast (collection)
         - Food Item 1 (document)
       - Lunch (collection)
         - Food Item 1 (document)
       - Dinner (collection)
         - Food Item 1 (document)
  </code></pre>
  <p>I now want to query for all food items that match certain criteria, i.e. <code>FoodItem.calories &lt; 500</code>.</p>
  <p>How should I set up this query?</p>
  <p>I wanted to use a <a href="https://firebase.google.com/docs/firestore/query-data/queries#collection-group-query" rel="nofollow noreferrer">Collection group query</a> but this only seems to work for 1 meal: E.g. breakfast, lunch, or dinner but not all three.</p>
  <p>Should I set up 3 queries, 1 per meal and then merge results, or is there a cleaner way?</p>
  <pre><code>const breakfast = query(collectionGroup(db, 'breakfast'), where('calories', '&lt;=', '100'));
  const querySnapshot = await getDocs(breakfast);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/yPXNE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yPXNE.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/BNBAC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BNBAC.png" alt="enter image description here" /></a></p>