title: Firebase Firestore Unsubscribe to SnapShot in for loop
body: <p>I am working with firebase firestore and I have set of data from collection that I am taking in snapshot which is in for loop. </p>
  
  <p>To avoid multiple time query the data base I have created data service mechnism to use the local array to display and I am handling it through rxjs subject behaviour.</p>
  
  <p>Issue here is if user deleted some document from application I have removed it from firebase and then from local still its snapshot we have to manually unsubscribe that </p>
  
  <p>I know the basic method which is like this..</p>
  
  <pre><code>var unsubscribe = db.collection("cities")
      .onSnapshot(function () {});
  // ...
  // Stop listening to changes
  unsubscribe();
  </code></pre>
  
  <p>This is not applicable in my case as I am taking snapshot in for loop like this</p>
  
  <pre><code>   getSnapShot() {
          this.global.currentUser.shortlist.forEach((propertyID: any) =&gt; {
            this.getSnapShotByID(ID);
          });
        }
      getSnapShotByID(ID) {
          // return new Observable((observe: Observer&lt;any&gt;) =&gt; {
          this.db.collection('properties').doc(propertyID).onSnapshot((snapshot: any) =&gt; {
  //HERE I AM ADDING PROPERTY IN LOCAL ARRAY
      ....
      }
  </code></pre>
  
  <p>Now when user Delete Property from collection I have to unsubscribe otherwise it will keep listening and changing my local array</p>
  
  <p>any suggestion idea ?</p>