title: AngularFire - How to map firestore documents to an array on valueChanges?
body: <p>In my angular web app I'm using the angularfire library to interact with firestore. </p>
  
  <p>In the constructor of a component I would like to subscribe to a collection of documents and map the docs to an array when the value changes function is triggered. </p>
  
  <p>I can easily display the list in the front end using the provided syntax. </p>
  
  <pre><code>//component constructor
  constructor(private afs: AngularFirestore) {
      this.itemsCollection = afs.collection&lt;Item&gt;('items');
      this.items = this.itemsCollection.valueChanges();
    }
  
  
  //component template
  &lt;ul&gt;
    &lt;li *ngFor="let item of items | async"&gt;
      {{ item.name }}
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>However, I need an array (or object) of the documents in that collection because I need to do some logic to render other things. For example I have a "isChecked" function that decides if a checkbox is checked based on if an item exists in that collection of documents. </p>
  
  <pre><code>async isChecked(itemID) {
      if(items[itemID]) {
       return true;
       } else {
       return false 
       }
  }
  </code></pre>
  
  <p>So, how can I get the documents to another variable and keep it updated on valueChanges?</p>