title: Firebase - right way to implement an undoable .update()?
body: <p>I'm just learning Firebase and noticed that any operation simply replaces the data, which is a bit different than what I've seen on couchDB.</p>
  
  <p>In my understanding of their documentation, for purposes of making a rollback/undo of an <code>.update()</code> operation possible, I would use the <code>.push()</code> method. The idea would be to keep 2 versions of the data, so that I can query for the previous object. TO boot, there would need to be a FILO kind of approach so I'm not storing more than 2 items.</p>
  
  <p>DATABASE BEFORE FIRST WRITE:</p>
  
  <pre><code>myData
  + someObject
    - keyOne : valueOne
    - keyTwo : valueTwo
  </code></pre>
  
  <p>DATABASE AFTER FIRST WRITE <code>ref.child(someObject).update({keyOne:valueOneUpdated})</code>:</p>
  
  <pre><code>myData
  + someObject
    - keyOne : valueOneUpdated
    - keyTwo : valueTwo
  </code></pre>
  
  <p>The above is NOT the desired result, since I lost the previous version of the item.</p>
  
  <p>DATABASE AFTER FIRST WRITE <code>ref.child(keyOne).push({keyOne:valueOneUpdated})</code>:</p>
  
  <pre><code>myData
  + someObject
    + keyOne
      + 1k34jh23kj4h : valueOneUpdated
      + 237we8sjkdf8 : valueOne
    - keyTwo : valueTwo
  </code></pre>
  
  <p>Yuck!
  As there is no <code>pop()</code> method to remove the last item of such an operation, I'm now faced with having to somehow figure out which is the first and which is the last item.</p>
  
  <p>Surely there must be some elegant and straightforward way to make rollback possible, no? What am I missing?</p>
  
  <p>Thanks.</p>