Best Practice for CouchDB Document Versioning
- by Groundwater
Following my question here I am exmploring ideas for a generic approach to document versioning in CouchDB. While I imagine there may be no canonical approach, I had the following idea and am looking for feedback.
I would like to maintain readable document ids as much as possible, so a document existing at /document1 would contain a pointer document to all existing versions on the system. The actual revision documents would be at something like /document1/308ef032a3801a where
308ef032a3801a is some random number or hash.
Example
The pointer document
{
"_id" : "document1",
"versions" : [ "document1/308ef032a3801a" ]
}
The version document
{
"_id" : "document1/308ef032a3801a",
... actual content
}