I'm new to CouchDB and trying to figure out the best way to store a history of changes for a document.
Originally, I was thinking the thing that makes the most sense is to use the update function of CouchDB but not entirely sure if I can. Is there someway to use the update function and modify/create a second document in the process? For example, if I have a document which contains notes for a client. Everytime I modify the notes document (ie: add new lines or delete lines), I want to maintain the changes made to it. If there was a way to use CouchDB's rev fields for this, my problem would be solved, but since CouchDB deletes non-current revs upon compaction, that is not an option. So instead, I want to create a "history_log" document, where I can just store the delta between documents (as a patch, for example). In order to do this, I need to have my existing document, my new document, compare the changes and write them to a history_log document. But I don't see if/where I can do that within and update handler. Is there something that can help me do this easily within CouchDB? Are there patch or json compare functions I can have access to from within a CouchDB handler? Thanks, Eric
