1

Is it possible to "scratch" a couchdb document? By that I mean to delete a document, and make sure that the document and its history is completely removed from the database.

I do not want to perform a database compaction, I just want to fully wipe out a single document. And I am looking for a solution that guarantees that there is no trace of the document in the database, without needing to wait for internal database processes to eventually remove the document.

(a python solution is appreciated)

blueFast
  • 41,341
  • 63
  • 198
  • 344

2 Answers2

2

When you delete a document in CouchDB, generally only the _id, _rev, and a deleted flag are preserved. These are preserved to allow for eventual consistency through replication. Forcing an immediate delete across an entire group of nodes isn't really consistent with the architecture.

The closest thing would be to use purge; once you do that, all traces of the doc will be gone after the next compaction. I realize this isn't exactly what you're asking for, but it's the closest thing off the top of my head.

Here's a nice article explaining the basis behind the various delete methods available.

phoebus
  • 14,673
  • 2
  • 33
  • 35
  • The _id and the _rev ... and the history of revisions, which allows for the full document to be recovered. But I see what you mean: in the context of replications it is very difficult to guarantee a real purge, and besides the side effect with view access is really a dead-end (my views take several minutes to update). Probably compaction is the only real option then. – blueFast Nov 16 '13 at 19:20
1

Deleting anything from file system for sure is difficult, and usually quite expensive problem. Even more with databases in general. Depending of what for sure means to you, you may end up with custom db, custom os and custom hw. So it is kind of saying I want fault tolerant system, yes everyone would like to have one, but only few can afford it, but good news is that most can settle for less. Similar is for deleteing for sure, I assume you are trying to adress some security or privacy issue, so try to see if there is some other way to get what you need. Perhaps encrypting the document or sensitive parts of it.

Davorin Ruševljan
  • 4,353
  • 21
  • 27