Javatpoint Logo
Javatpoint Logo

CouchDB Create Document

In CouchDB, data of the database is stored in the form of documents instead of tables.

Create a document in CouchDB database using Fauxton

To create a document in CouchDB database open the Fauxton url:

Choose the specific database and put your cursor on all documents tab. Click on new Doc as shown in the below image:

Create Document 1

You will a page like:

Create Document 2

Fill the entries which you want in your documents:

Create Document 3

After all entries, click on the save changes tab. Now the document is created.

Create Document 4

CouchDB Create Document using cURL Utility

To create a document in CouchDB, send an HTTP request to the server using PUT method through cURL utility.

Following is the syntax to create a document.


Note: -X is used to specify a custom request method of HTTP that we use to communicate with the HTTP server. In this case, we are using PUT method. When we use the PUT method, the content of the url specifies the object name we are creating using the HTTP request.

  • The database name specifies the name of the database in which we are creating the document.
  • Id specifies the document id.
  • The data of the document. ?d option is used to send the data/document through HTTP request.


Let's create a document with id "001" with database name javatpoint.

CouchDB Create document 1

The response of CouchDB for this command contains 3 fields:

  • "ok": It specifies that the operation is successful.
  • "id": It stores the id of the document.
  • "rev": This indicates the revision id. Every time you revise (update or modify) a document a _rev value will be generated by CouchDB. If you want to update or delete a document, CouchDB expects you to include the _rev field of the revision you want to change. When CouchDB accepts the change, it will generate a new revision number.


You can verify that your document is created by using the following command:

CouchDB Create document 2

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA