title: Update firebase database with time-based key on iOS
body: <p>I'm using Firebase and iOS to keep a time series of an integer value over the last 24 hours. I have tried using both the <code>.updateChildValues()</code> and <code>.setValue()</code> from the docs, but haven't yet figured out how to keep firebase from overwriting every child value, not just the child value with the same key. </p>
  
  <pre><code>func writeStepsPost(withUserID userID: String, steps: NSNumber) {
      let timeStamp = NSDate().timeIntervalSince1970 as NSNumber
      let post_user: NSString = userID as NSString
      let value: NSNumber = steps
  
      let post = ["uid": post_user,
                  "steps": value,
                  "lastUpdate":timeStamp]
      let childUpdates = ["/posts-steps-user/\(userID)/": post]
      ref.updateChildValues(childUpdates)
      let currentHour = Calendar.current.component(.hour, from: Date())
      let hourlyPost = ["steps":value]
      let dailyUpdates = ["/posts-steps-user/\(userID)/pastDay/\(currentHour):00/": hourlyPost]
      print("posting hourly steps update")
      ref.updateChildValues(dailyUpdates)
  </code></pre>
  
  <p>When the time changes from 10 to 11, the node for <code>'10:00':123</code> is replaced by <code>'11:00':243</code>, when I need to add a node for <code>11</code> while leaving <code>10</code> in place until the next day. I suspect that since the function is pushing two updates, the first update replaces the existing node. </p>
  
  <p>Any ideas? </p>