title: SQL like joins in Firestore
body: <p>I have a collection called <code>creditcards</code> and a  collection called <code>ownedcreditcards</code> in Cloud Firestore. I want to perform a query where I JOIN the two collections to find only the creditcards that exists in the <code>creditcards</code>-collection, and not in the <code>ownedcreditcards</code>. From my understanding SQL like JOINS does not exist in Firestore, and you have to retrieve the data in multiple queries. I am trying to call the <code>getAll()</code>-functions (which retrieves all the documents) on both my collections, temporarily store the data in two <code>ArrayLists</code>, and then compare the two lists with each other. But my attempts of storing the data in an <code>ArrayList</code> has been unsuccessful, as it returns empty when I try to <code>LOG</code> it.<br />
  How can I store the data from both my collections in an <code>ArrayList</code>, or is there an easier way of doing this?</p>
  <p><strong>creditcards-collection</strong> with the following fields:</p>
  <ul>
  <li>id</li>
  <li>name</li>
  <li>provider</li>
  </ul>
  <p><img src="https://i.stack.imgur.com/pH6oV.jpg" alt="creditcards-collection" /></p>
  <p><strong>ownedcreditcards-collection</strong> with the following fields:</p>
  <ul>
  <li>id</li>
  <li>creditcardid</li>
  <li>creditcardname</li>
  <li>nickname</li>
  <li>userid</li>
  </ul>
  <p><img src="https://i.stack.imgur.com/WZQ2n.jpg" alt="ownedcreditcards-collection" /></p>
  <hr />
  <p>The code for my <code>Activity</code>and <code>Store</code>-classes are more or less identical for both <code>usercreditcard</code> and <code>creditcard</code>. Below is the code for the <code>usercreditcard</code>.</p>
  <p><strong>UserCreditCardActivity.kt</strong></p>
  <pre><code>val arrayList = ArrayList&lt;Any&gt;()
  
      private fun retrieveCards() {
      val userCreditcard = UserCardStore()
      userCreditcard.getAll(object : Callback&lt;UserCardModel&gt; {
          override fun onCallback(list: List&lt;UserCardModel&gt;) {
              for (card in list) {
                  adapter.add(UserCardItem(card)) //this works
                  arrayList.add(card) //this doesnt work as when I print the list it returns empty
              }
          }
      })
  }
  </code></pre>
  <p><strong>UserCardStore.kt</strong></p>
  <pre><code>    override fun getAll(myCallback: Callback&lt;UserCardModel&gt;) {
      auth = FirebaseAuth.getInstance()
      documentdata.whereIn(&quot;userid&quot;, listOf(auth.uid))
         .get().addOnCompleteListener { task -&gt;
          if (task.isSuccessful) {
              val list = ArrayList&lt;UserCardModel&gt;()
              for (document in task.result!!) {
                  val usercard = document.toObject(UserCardModel::class.java)
                  list.add(usercard)
              }
              myCallback.onCallback(list)
          }
      }
  }
  </code></pre>