Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The app I'm building uses incremented version counters as a way of protecting against simultaneous edits. I'm discarding the old version of each document, but it would be pretty trivial to save them using the "returnChanges" option of r.update() [1].

If you set returnChanges, the result will contain two properties, old_val and new_val. You could take the contents of old_val, give it a unique identifier, and then store it in another table with r.create().

[1] More about r.update(): http://rethinkdb.com/api/javascript/update/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: