title: Firebase Swift .exist() not working
body: <p>Hello I am using firebase on swift and having an issue with .exist()</p>
  
  <p>I am trying to do a query and check for a value, if its there I do nothing, if it isn't I add it to the list. I am just trying to avoid duplicating data this way. Heres the code:</p>
  
  <pre><code>InfoCenter.ref.child("users/\(InfoCenter.userId)/following").queryOrderedByValue()
      .queryEqualToValue(firstTextField.text)
      .observeEventType(.Value, withBlock: { snapshot in
          if snapshot.exists(){
             self.displayAlert("You already follow that person!", Title: "Whoops")
             print(snapshot.value!)
          } else {
             InfoCenter.ref.child("users/\(InfoCenter.userId)/following").childByAutoId().setValue(TheId)
             InfoCenter.ref.child("users/\(TheId)/followers").childByAutoId().setValue(InfoCenter.userId)
             print(snapshot.value!)
          }
   })
  </code></pre>
  
  <p>so to me everything looks right, but when it runs snapshot.exist() always returns false but when I print snapshot.value! I get null with arrows around it (I couldn't type the arrows because SO thought it was a tag then) . So I'm confused.. how is null considered exists? Can someone please show me what to change to fix this? Thanks!!</p>
  
  <p>Edit:
  To be clear following is a list of users. So with in following are autoId's that have links to other users. The whole purpose of the above query is to go through the autoId's and make sure that this person does not already follow that person. Here is a snapshot of the data structure I am trying to explain:</p>
  
  <p><a href="https://i.stack.imgur.com/BJx56.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BJx56.png" alt="enter image description here"></a></p>