Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

couchdb - deleting revision

Tags:

nosql

couchdb

How is it possible to relete old revisions of couchdb document?

like image 958
Andrey Kuznetsov Avatar asked Aug 13 '10 18:08

Andrey Kuznetsov


People also ask

How do I delete a record on CouchDB?

You can delete a document in CouchDB by sending an HTTP request to the server using DELETE method through cURL utility. Following is the syntax to delete a document. Using −X, we can specify a custom request method of HTTP we are using, while communicating with the HTTP server. In this case, we are using Delete method.

How do I update files in CouchDB?

Open the Fauxton url:http://127.0.0.1:5984/_utils/ You can also update/ change/ edit your document once you created. Click on the edit option (encircled in red). After clicking, you will get a new page where you can edit your entries. After editing click on the save changes tab and your document will be updated.

How do I update a document in PouchDB?

You can update an existing document in PouchDB using the (_rev). To do so, first of all retrieve the _rev value of the document we want to update. Now, place the contents that are to be updated along with the retrieved _rev value in a new document, and finally insert this document in PouchDB using the put() method.


2 Answers

You cannot delete an old revision of a single document. This is because the old revisions are only used by CouchDB internally for concurrency control and you shouldn't have to worry about these revisions.

If you want to remove all old revisions in order to shrink the size of your database, you can run compaction.

like image 68
Niels van der Rest Avatar answered Sep 23 '22 23:09

Niels van der Rest


take care that it is not enough to delete the documents and their revisions with compaction, still some data is being saved in the db such as the last revision of the document.

In order to be 100% sure to delete all data you have to purge your db using this api:

POST /{db}/_purge

More on: http://docs.couchdb.org/en/1.6.1/api/database/misc.html

like image 30
FranZ Avatar answered Sep 22 '22 23:09

FranZ