title: How to loop through a document collection to get a specific document from a subCollection
body: <p>I am working on a flutter app that allows a user to select and book a trip. The data source is Firestore and is configured as follows:</p>
  
  <pre><code>Firestore -- Root
     |
     trips -- collection
       |
       Auto-ID -- Document
         |
         bookings -- collection
            |
            Auto-ID -- Document
  </code></pre>
  
  <p>There are a list of trip documents that are created with an Auto-ID and placed in the trips collection.</p>
  
  <p>A user can select a trip and make a booking and this creates a document in the bookings collection. (subCollection of trips)</p>
  
  <p>I can get a list of all the bookings for one trip using the following query:</p>
  
  <pre><code>Stream&lt;QuerySnapshot&gt; getAllBookings(document) {
      return db
          .collection('trips')
          .document(document)
          .collection('bookings')
          .snapshots();
  }
  </code></pre>
  
  <p>I can get a booking by one user using the following query:</p>
  
  <pre><code>Stream&lt;QuerySnapshot&gt; getUserBookings(document, user) {
      return db
          .collection('trips')
          .document(document)
          .collection('bookings')
          .where('user', isEqualTo: user)
          .snapshots();
  }
  </code></pre>
  
  <p>But I cannot fathom out how to combine the two to loop over all the trips to find all the trips booked by one user and return this as a stream.</p>
  
  <p>Any help would be much apprciated.</p>