GET /{db}/_all_docs

In this document

This request returns a built-in view of all documents in the database.

Request


Request headers

This request does not have any required headers.

Query parameters

This request uses the following query parameters:

NameTypeDescriptionDefault
conflictsBooleanInclude conflict information in the response. This parameter is ignored if the include_docs parameter is false.false
descendingBooleanReturn documents in descending orderfalse
endkeystringIf this parameter is provided, stop returning records when the specified key is reached.none
end_keystringAlias for the endkey parameternone
endkey_docidstringIf this parameter is provided, stop returning records when the specified document identifier is reachednone
end_key_doc_idstringAlias for the endkey_docid parameternone
include_docsBooleanIndicates whether to include the full content of the documents in the responsefalse
inclusive_endBooleanIndicates whether the specified end key should be included in the resulttrue
keystringIf this parameter is provided, return only document that match the specified key.none
limitintegerIf this parameter is provided, return only the specified number of documentsnone
skipintegerIf this parameter is provided, skip the specified number of documents before starting to return results0
stalestringAllow the results from a stale view to be used, without triggering a rebuild of all views within the encompassing design document. Valid values: ok and update_after.none
startkeystringIf this parameter is provided, return documents starting with the specified key.none
start_keystringAlias for startkey paramnone
startkey_docidstringIf this parameter is provided, return documents starting with the specified document identifier.none
update_seqBooleanIndicates whether to include the update_seq property in the responsefalse

Message body

This request does not use a message body.

Response


Status codes

Response headers

Message body

The message body is a JSON document that contains the following objects:

NameTypeDescription
offsetintegerStarting index of the returned rows.
rowsarrayArray of row objects. Each row contains the following objects: id, key, and value. The value object contains the revision identifier in a rev object.
total_rowsintegerNumber of documents in the database.This number is not the number of rows returned.
update_seqintegerSequence identifier of the underlying database that the view reflects

Example


The following request retrieves all documents from a database named cookbook.

Request

GET /cookbook/_all_docs HTTP/1.1
Host: localhost:59840

Response

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: must-revalidate
Content-Type: application/json
Date: Fri, 13 Dec 2013 02:42:23 GMT
Etag: "3"
Server: CouchbaseLite 1.486
{
  "offset" : 0,
  "rows" : [
    {
      "key" : "209BB170-C1E0-473E-B3C4-A4533ACA3CDD",
      "value" : {
        "rev" : "1-ed0ebedd2fab89227b352f6455a08010"
      },
      "id" : "209BB170-C1E0-473E-B3C4-A4533ACA3CDD"
    },
    {
      "key" : "A329CFEC-29E8-4DCF-BB49-EFCE8CD6B212",
      "value" : {
        "rev" : "1-afbf905396a144446feb2431c37065f9"
      },
      "id" : "A329CFEC-29E8-4DCF-BB49-EFCE8CD6B212"
    },
    {
      "key" : "LemonChicken",
      "value" : {
        "rev" : "1-78abf9a6508671ba8338e4ef6daa910a"
      },
      "id" : "LemonChicken"
    }
  ],
  "total_rows" : 3
}