title: Reading root and then multiple sub-collections in Firestore
body: <p>I have two collections A and B in Firestore and I’m using Angular 5.2 and Angularfire2.
  A is the root collection and each document in A holds a sub-collection B.</p>
  
  <p>I have the following challenge:</p>
  
  <ol>
  <li>I need to read a subset of from collection A</li>
  <li>For each of the documents in the subset need to read the underlying sub-collection.</li>
  <li>Data will then be presented in a table.
  Reading the sub-set will require using .snapshot(), since I need the Id from the sub-set. Then I want to iterate through the result and read each underlying sub-collection.</li>
  </ol>
  
  <p>I’ve tried to use switchMap, concatMap, concatAll, etc, but I get different type an errors for each one of them.</p>
  
  <pre><code>const rootCollection = this.afs
    .doc(collection.USERS + `/${email}`)
    .collection&lt;MyMeasurement&gt;(collection.MY_MEASUREMENT, ref =&gt;
      ref.where('selected', '==', true).orderBy('name', 'asc')
    )
    .snapshotChanges()
    .pipe(
      map(changes =&gt; {
        return changes.map(action =&gt; {
          const data = action.payload.doc.data() as MyMeasurement;
          data.id = action.payload.doc.id;
          return data;
        });
      })
    );
  
  const concatCollection = rootCollection.pipe(concatMap(data =&gt; data.forEach(element =&gt; {      
    // her comes the inner observer 
    // Her is the error message:
    // Argument of type '(data: MyMeasurement[]) =&gt; void' is not assignable to parameter of type '(value: MyMeasurement[], index: number) =&gt; ObservableInput&lt;{}&gt;'.
    //Type 'void' is not assignable to type 'ObservableInput&lt;{}&gt;'.
  })))
  
  const subscribe.concatCollection(data =&gt; console.log(data));
  </code></pre>