Firebase when query is empty
<p>I perform a query using firebase to check if there are any objects that have a child with a certain value. The problem is if there are no such objects the code doesn't run. So in the code below if there are no objects that have a child with <code>facebookID</code> that is <code>17</code> the rest of the code will never run. Is there a way to determine when a query finds <code>0</code> results?</p>

<pre><code>func previousUser(completion:(result:Bool)-&gt;Void){

    var queryFound = false
    print("check if user is previous")
    print(UserData.globalfacebookID)
    let ref = Firebase(url:"https://amber-torch-556.firebaseio.com/Users")
    ref.queryOrderedByChild("facebookID").queryEqualToValue(17).observeSingleEventOfType(.ChildAdded, withBlock: { snapshot in

    print(snapshot.childrenCount)
    print("query has ran")
    UserData.globalparseID = snapshot.key

    queryFound = true
    completion(result:queryFound)

})
</code></pre>