title: How do I check if a firebase database value exists?
body: <p>I'm using the Realtime Database with Google's Firebase, and I'm trying to check if a child exists.</p>
  
  <p>My database is structured as the following</p>
  
  <pre><code>- / (root)
  -   /users/
  –-    /james/
  --    /jake/
  -   /rooms/
  --    /room1/
  ---      (room 1 properties)
  --    /room2/
  ---      (room 2 properties)
  </code></pre>
  
  <p>I would like to check if room1 exists.
  I have tried the following:</p>
  
  <pre><code>let roomName:String = "room1"
  roomsDB.child(roomName).observeSingleEventOfType(.Value) { 
  (snap:FIRDataSnapshot) in
      let roomExists:Bool = snap.value != nil ? "TAKEN" : "NOT TAKEN"
   }
  </code></pre>
  
  <p>In accessing <code>snap.value</code> it returns a JSON of the properties of that room, but how would I check if the room (<code>/rooms/room1/</code>) is there to begin with?</p>
  
  <p>Comment if any clarification is needed</p>