CouchDB Deleting Document

You can Delete a document in CouchDB by sending an HTTP request to the server using PUT method through cURL utility.


curl -X DELETE http : // / database-name/database id?_rev id

Example :

The database with the "contacts" contains the document with ID johndoe.
First you have to get the revision ID of the document which is to be deleted. If you don't know _rev, you can find yourself in the document using the command below. Now after getting the revision ID, use _rev from the document to delete the document. Now, we are deleting the document.

Find revision ID
$ curl -X GET
"_id" : "johndoe",
"_rev" : "2-04d8eac1680d237ca25b68b36b8899d3 " ,
"age" : "25"
Deleting Document
$ curl -X DELETE

Verification :

If you want to Verify the document, you can verify using GET request.Since you are fetching a deleted document, this will give you an error message as shown below −

$ curl -X GET

Visit :


* You must be logged in to add comment.