title: Retrieve firebase data
body: <p>Here is the firebase data tree
  <a href="https://i.stack.imgur.com/vczym.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vczym.png" alt="enter image description here"></a></p>
  
  <p>There are two parents and each having two child each. How to retrieve all the data for "sex".</p>
  
  <p>Here's is my code. </p>
  
  <pre><code>ref.child("Doctor").observeSingleEventOfType(.Value, withBlock: { (snapshot) in
              if let result = snapshot.children.allObjects as? [FIRDataSnapshot] {
                  for child in result {
  
                      print("Here 1")
                      print(child)
                      let gender = child.value!["sex"] as? String
                      print("Here 2")
                      //print("Sex")
                      print(gender)
                  }
  
              } else {
                  print("no results")
              }
          }) { (error) in
              print(error.localizedDescription)
          }
  </code></pre>
  
  <p>When I am printing the value of gender, it is showing <strong>nil</strong> value.</p>