-
Hello folks, I'm writing an end-user app where the user basically sees and edits each document individually. I want to show them a history of all the changes they've made (or synced). I first tried using the The least crazy idea I can think of right now is to (a) add my own last-modified timestamp to each document (yes, with the potential shenanigans of wrong clocks), (b) use Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
The problem is the old revs will be cleaned up the next time compaction runs. As far as I know the only way to do this would be to never edit or delete a doc, but create a new document every time and do the comparison with business logic. |
Beta Was this translation helpful? Give feedback.
-
As @garethbowen suggested: rely on the revisions of CouchDB/PouchDB for a git-style history isn't a good Idea. My quick-n-dirty/straight-from-the-head idea: create documents for each new edit, and pump some meta information about the changes (e.g. diff-tree) and a reference to your previous doc. |
Beta Was this translation helpful? Give feedback.
-
Putting the revision in the ID seems like it would work. But I don't see how that's better than just not running compaction, which I'm not forced to do, right? And then when I sync, I have to do manually do all the conflict detection and resolution Pouch does for me. It's also important that my documents link to each other, so all those links would become searches instead of plain lookups (I definitely don't want to deal with deconflicting user edits and recursive link updates if I can help it). |
Beta Was this translation helpful? Give feedback.
-
At that point I wonder if it would be better to just store the history inside each document, or something along those lines. |
Beta Was this translation helpful? Give feedback.
-
So I've got a handful of possible solutions:
Are there any other broad categories of solution I'm missing? It seems like there must be a few, but my brain is still stuck in the box. (...where "item" is the actual doc I'm trying to version-control. I'm pretty well committed to UUIDs for these guys, fwiw, since their structure is very dynamic) |
Beta Was this translation helpful? Give feedback.
So I've got a handful of possible solutions:
Are there any other broad categories of solution I'm missing? It seems like there must be a …