version-controlcouchdbcompact-database

Couchdb compaction and deleted documents


When I delete document its revision is increased, then PUT the same document, its revision is increased. After compaction, PUT the same document, its revision is started from 1. And now, when I got document, I have the message, that this document was deleted.

After second time I do PUT the same document, I have document, with revision before compaction + 1, and after GET this document, shows me correctly actual state. Why ?

enter image description here


Solution

  • This is an instance of COUCHDB-1415, which happens if you delete a document then attempt to insert the document again with exactly the same content. The workaround is to add changed data to the document before inserting a new revision after the delete happens.

    From the bug, looks like it will be fixed in 2.0, which is being worked on at the moment.