title: Firestore collectionReference returns all documents
body: <p>I am using Firebase Firestore to query some documents with a certain id. This is my structure:</p>
  
  <p>EDIT: SCREENSHOT AND DESCRIPTION ADDED JUST AFTER THIS LINE:</p>
  
  <p><code>generatedId</code> and <code>id</code> have the same value. I have a list of these "id" and I want to search the <code>public_messages</code> collection to return a list of items which my provided list of "id".</p>
  
  <p><a href="https://i.stack.imgur.com/AWFps.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AWFps.png" alt="firestore structure"></a></p>
  
  <pre><code>root
  ----- public_messages
  ---------- generatedId
  -------------------- name
  -------------------- id  
  ---------- generatedId
  -------------------- name
  -------------------- id  
  ----- other data
  </code></pre>
  
  <p>I am using the following code to query the messages with a certain id:</p>
  
  <pre><code> ArrayList&lt;String&gt; keys ... (this has some keys)
  
      CollectionReference collectionReference = firebaseFirestore.collection("public_messages");
  
      for (String id : keys) {
          collectionReference.whereEqualTo("id", id);
      }
  
      collectionReference.get().addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
          @Override
          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
              if (task.isSuccessful()) {
                  int count = 0;
                  for (QueryDocumentSnapshot document : task.getResult()) {
                      count++;
                  }
                  loog("total messages = " + count);
              } else {
                  Log.d("TAG", "Error getting documents: ", task.getException());
              }
          }
      });
  </code></pre>
  
  <p>In <code>onComplete</code>, the variable <code>task.getResult()</code> returns all the documents in the said collection. Consequently, the variable <code>count</code> represents the total number of documents in the said collection.</p>
  
  <p>I want to only query the results with the specified ids. The number of ids can exceed 10 (which is apparently the limit set by Google, and which limit I was trying to evade by using a for-loop). What should I do?</p>