Javatpoint Logo
Javatpoint Logo

CouchDB Update Document

Update (edit) document using fauxton

Open the Fauxton url:

You can also update/ change/ edit your document once you created. Click on the edit option (encircled in red).

Update Document 1

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.

For example: In the below example employee name is Ajeet Kumar, Age is 27 and address is Delhi.

Update Document 2

Now, update the name Ajeet Kumar to Sonoo Jaiswal and address Delhi to Noida.

Update Document 3

Click on the "save changes" tab and your document will be updated.

CouchDB Update Document Using cURL utility

cURL facilitates users to update the document in CouchDB by sending an HTTP request to the server using PUT method through cURL utility.



We have a document with id 001 in the database named my_database.

First of all, retrieve the revision id of the document that is to be updated. You can find the _rev of the document in the document by using the following command:

CouchDB Update document 1

Use revision id _rev from the document to change the data. Here we change the age from 23 to 27.

CouchDB Update document 2


You can verify the document if it is updated or not by using again the GET request.

CouchDB Update document 3

Here you can see that age is now updated.

Points to remember while updating a document:

  • The URL we send in the request must contain the database name and the document id.
  • Updating an existing document is same as updating the entire document. It is not possible to add a field to an existing document. You can only write an entirely new version of the document into the database with the same document ID.
  • Use the revision number as a part of the JSON request.
  • In return JSON contains the success message, the ID of the document being updated, and the new revision information. If you want to update the new version of the document, you have to quote this latest revision number.

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA