title: How to retrieve data's name in Firebase
body: <p>I'm not sure if "data's name" is the correct way to call it but here is my problem:</p>
  
  <p>I have a table like this</p>
  
  <p><a href="https://i.stack.imgur.com/Kp8Jc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kp8Jc.png" alt="enter image description here"></a></p>
  
  <p>I want to create 2 arrays that contain the ID (<code>0001, 0040</code>) and the Date (<code>13-9-2017</code>). </p>
  
  <p>Because IDs are generated automatically so I don't know how to query</p>
  
  <p>What I've tried:</p>
  
  <pre class="lang-swift prettyprint-override"><code>func retrievingPresciptionID(){
          let userID = appDelegate.userIDFirebase
          Database
              .database()
              .reference()
              .child("UserInformation")
              .child(userID)
              .child("prescriptionID")
              .observeSingleEvent(of: .value, with: {snapshot in
                  if snapshot.exists(){
                      for id in snapshot.children {
                          self.prescriptionID.append((id as AnyObject).key)
                      }
                      print(self.prescriptionID)
                  }else{
                      print("snapshot failed")
                  }
              })
      }
  </code></pre>
  
  <p>It printed <code>snapshot failed</code></p>