How is it possible to relete old revisions of couchdb document?
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With