couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Gerakines" <>
Subject Re: Selectively keeping revisions around
Date Tue, 22 Jul 2008 21:24:26 GMT
The use-case that I had in mind was a wiki document. You've got a
blurb for the content and then a bunch of tuples representing
meta-data. When user A comes around and edits the wiki page the
document the new and old versions are both kept around for historical
purposes. Being able to revert a document for one reason or another is

The example that I'm envisioning doesn't really use old versions for
any sort of lookups or indexing so saving them as attachments will do.

# Nick Gerakines

On Tue, Jul 22, 2008 at 1:50 PM, Jan Lehnardt <> wrote:
> On Jul 22, 2008, at 19:22 , Kurt Mackey wrote:
>> I'm admittedly pretty new to CouchDB, but I'm having a tough time figuring
>> out how to use the document revisions it keeps around.  As I understand it,
>> PUTs replace what's there, leaving what's there in a deleted state until you
>> compact the database, at which point it goes away forever.
>> So given that (and correct me if I got it wrong), what's the best way of
>> keeping revisions around forever?  I have a number of documents that will be
>> changed quite frequently, and I'd like to get at their history, provide
>> diffs against it, etc.  Is anyone doing this?
> Sorry to disappoint you.
> Do not rely on the revisions for what you want to do.
> Only go with the no-compaction route if you have
> very little data.
> To keep documents around you can do two things:
>  1) Save old revisions as attachments to the most
> recent revision.
>  2) Save old revisions as new documents.
> Both come with advantages and disadvantages and
> both seem clumsy in the light of possibly using the
> built in revision system. We'd like to have the revision
> system work as you want to use it, but getting it right
> with the distributed replication is kinda tricky, so we
> don't do that as of yet and you should not rely on it.
> 1) Advantages
> All data is available under a single doc id.
> 1) Disadvantages
> You need to copy around revisions manually.
> Can't use the structure of your old revisions in views.
> 2) Advantages
> You can use your old revisions in views.
> You can use view to collect a doc and all revisions
> (see
> 2) Disadvantages
> Data is spread over multiple doc ids.
> (There might be more, I'm kinda short on time at the moment,
> fill in the blanks please :)
> Cheers
> Jan
> --

View raw message