title: How to query firebase to filter on a certain value
body: <p>Im trying to get all the imageURLs for all activities that are for a specific user (UserId). the content of the snapshot include the correct entries, however the imageURL is not appended to imageArray. What am I doing wrong?</p>
  
  <pre><code> // Get all images for a specific user
  
      func getImagesForUser(userId:String, handler: @escaping (_ imageArray: [String]) -&gt; ()) {
          var imageArray = [String]()
  
          REF_ACTIVITY.queryOrdered(byChild: "userId").queryEqual(toValue: userId).observe(.value, with:  { snapshot in
              dump(snapshot)
              guard let data = snapshot.value as? NSDictionary else { print("else was returned"); return }
  
              let imageURL = data["imageURL"] as? String ?? ""
              imageArray.append(imageURL)
              handler(imageArray)
          })
  
      }
  </code></pre>
  
  <p>Output from dump(snap)</p>
  
  <pre><code>Snap (-L2RDXTKANzD8YGpPl92) {
      gearId = asfasfsf;
      imageCount = 3;
      imageURLs =     {
          1 = "http://www.foo.com";
          2 = "http://www.foo2.com";
          3 = "http://www.foo3.com";
      };
      killCount = 10;
      kills = 12;
      likeCount = 2;
      likes =     {
          fas86q39rasf = 1;
      };
      userId = NhZZGwJQCGe2OGaNTwGvpPuQKNA2;
  }
  
  Snap (-L2RDXTKANzD8YGpPl92) {
      gearId = asfasfsf;
      imageCount = 3;
      imageURLs =     {
          1 = "http://www.foo.com";
          2 = "http://www.foo2.com";
          3 = "http://www.foo3.com";
      };
      killCount = 10;
      kills = 12;
      likeCount = 2;
      likes =     {
          fas86q39rasf = 1;
      };
      userId = NhZZGwJQCGe2OGaNTwGvpPuQKNA2;
  }
  </code></pre>
  
  <p><strong>Update - output of Dict</strong></p>
  
  <pre><code>24 elements
    ▿ 0 : 2 elements
      - key : "commentCount"
      - value : 1
  // removed some info
  ...
    ▿ 12 : 2 elements
      - key : "imageURLs"
      ▿ value : 4 elements
        - 0 : &lt;null&gt;
        - 1 : https://firebasestorage.googleapis.com/v0/b/shoota-179610.appspot.com/o/activity_image%2FCA6F4C93-8F5F-456C-9FD6-F2EACC444739?alt=media&amp;token=522d957b-dedf-4bdc-9cbc-1de581284393
        - 2 : https://firebasestorage.googleapis.com/v0/b/shoota-179610.appspot.com/o/activity_image%2FCA6F4C93-8F5F-456C-9FD6-F2EACC444739?alt=media&amp;token=522d957b-dedf-4bdc-9cbc-1de581284393
        - 3 : https://firebasestorage.googleapis.com/v0/b/shoota-179610.appspot.com/o/activity_image%2FCA6F4C93-8F5F-456C-9FD6-F2EACC444739?alt=media&amp;token=522d957b-dedf-4bdc-9cbc-1de581284393
    ▿ 13 : 2 elements
      - key : "imageURL"
      - value : https://firebasestorage.googleapis.com/v0/b/shoota-179610.appspot.com/o/activity_image%2FCA6F4C93-8F5F-456C-9FD6-F2EACC444739?alt=media&amp;token=522d957b-dedf-4bdc-9cbc-1de581284393
    ▿ 14 : 2 elements
      - key : "killCount"
      - value : 10
  </code></pre>