Differences between revisions 5 and 6
Revision 5 as of 2008-11-05 01:41:02
Size: 1250
Editor: MartinCzura
Comment: redirect
Revision 6 as of 2009-09-20 21:45:08
Size: 1250
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
CouchDB does not overwrite updated documents in place, instead it creates a new document at the end of the database file, with the same `_id` but a new `_rev` identifier. This type of storage system is space-wasteful so regular ["Compaction"] is needed to reclaim disk space. Note that the older revisions are not available to ["Views"]. CouchDB does not overwrite updated documents in place, instead it creates a new document at the end of the database file, with the same `_id` but a new `_rev` identifier. This type of storage system is space-wasteful so regular [[Compaction]] is needed to reclaim disk space. Note that the older revisions are not available to [[Views]].

Overview

CouchDB does not overwrite updated documents in place, instead it creates a new document at the end of the database file, with the same _id but a new _rev identifier. This type of storage system is space-wasteful so regular Compaction is needed to reclaim disk space. Note that the older revisions are not available to Views.

Document revisions are used for optimistic concurrency control. If you try to update a document using an old revision the update will be in conflict. These conflicts should be resolved by your client, usually by requesting the newest version of the document, modifying and trying the update again.

@@ How does this relate to replication conflicts?

Revision History

You cannot rely on document revisions for any other purpose than concurrency control.

Due to compaction, revisions may disappear at any time. You cannot use them for a client revision system.

If you wish to implement revisions in your client system a number of patterns have been suggested:

  • Using attachments to store old revisions.
  • Using multiple documents to store old revisions.

@@ Please add to this list and flesh out the solutions as you see fit.

DocumentRevisions (last edited 2009-09-20 21:45:08 by localhost)