title: Firestore query on android app is returning empty
body: <p>Description: I'm making an inventory-keeping app where the number of items you use for your work (or &quot;case&quot;) are deducted from the larger number of those items you have in your existing inventory. All data of existing inventory is stored in Firestore under <strong>&quot;materials&quot;</strong> collection.</p>
  <p>Problem: The loop I prepared to access the <em>querySnapshotDocument</em> can't be reached. I was hoping I could get the <em>Material</em> object I need from the loop. But I think I'm missing something.</p>
  <pre><code>private void findMaterialInDB(Material material, MaterialDialog dialog) {
      db.collection(&quot;materials&quot;)
              .whereEqualTo(&quot;material&quot;, material.getMaterial())
              .whereEqualTo(&quot;size&quot;, material.getSize())
              .whereEqualTo(&quot;description&quot;, material.getDescription())
              .limit(1).get()
              .addOnSuccessListener(new OnSuccessListener&lt;QuerySnapshot&gt;() {
                  @Override
                  public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                      Material inventoryMaterial;
                      int inventoryquantity = 0;
                      int casequantity = 0;
  
                      Log.d(&quot;caseQuantityCheck&quot;, &quot;Task successful!&quot;);
                      for (QueryDocumentSnapshot document : queryDocumentSnapshots) {
                          inventoryMaterial = document.toObject(Material.class);
                          Log.d(&quot;caseQuantityCheck&quot;, &quot;data: &quot; + document.getData());
  
                          inventoryquantity = Integer.parseInt(inventoryMaterial.getQuantity());
                          casequantity = Integer.parseInt(material.getQuantity());
  
                          if (inventoryquantity &lt; casequantity) {
                              Toast.makeText(context, &quot;Not enough materials in Inventory&quot;, Toast.LENGTH_LONG).show();
                          } else {
                              //decrease value
                              material.setQuantity(&quot;&quot; + (inventoryquantity - casequantity));
                              //TODO: update the firebase value also
                              //proceed to creating case
                              Log.d(&quot;caseQuantityCheck&quot;, &quot;Material : \n\n&quot; + material);
                              exitingMaterials.add(material);
                              dialog.dismiss();
                              materialCount.setText(&quot;Materials (&quot; + exitingMaterials.size() + &quot;)&quot;);
                          }
                      }
  
                  }
              });
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/pO5HM.png" rel="nofollow noreferrer">Snapshot of the &quot;materials&quot; collection</a></p>