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

You can add a field "last_updated", and update a document with the option {returnChanges: true}, and you'll get the new and old values. You can then save the old values in another table like "history" where the primary key is `_id` instead of `id`.

In this case, you can do r.table("data").get(1) // get the current version of the document with id 1 r.table("history").getAll(1, {index: "id"}) // get all the previous versions of the document with id 1. And you can order them by `last_updated` if you want too.



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

Search: