GET /{db}/_all_docs
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:
| Name | Type | Description | Default |
|---|---|---|---|
conflicts | Boolean | Include conflict information in the response. This parameter is ignored
if the include_docs parameter is false. | false |
descending | Boolean | Return documents in descending order | false |
endkey | string | If this parameter is provided, stop returning records when the specified key is reached. | none |
end_key | string | Alias for the endkey parameter | none |
endkey_docid | string | If this parameter is provided, stop returning records when the specified document identifier is reached | none |
end_key_doc_id | string | Alias for the endkey_docid parameter | none |
include_docs | Boolean | Indicates whether to include the full content of the documents in the response | false |
inclusive_end | Boolean | Indicates whether the specified end key should be included in the result | true |
key | string | If this parameter is provided, return only document that match the specified key. | none |
limit | integer | If this parameter is provided, return only the specified number of documents | none |
skip | integer | If this parameter is provided, skip the specified number of documents before starting to return results | 0 |
stale | string | Allow 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 |
startkey | string | If this parameter is provided, return documents starting with the specified key. | none |
start_key | string | Alias for startkey param | none |
startkey_docid | string | If this parameter is provided, return documents starting with the specified document identifier. | none |
update_seq | Boolean | Indicates whether to include the update_seq property in the
response | false |
Message body
This request does not use a message body.
Response
Status codes
- 200 OK – Request completed successfully
- 400 — Invalid database
- 404 — Database not found
Response headers
Content-Type—The value can be:- application/json
- text/plain; charset=utf–8
ETag—Response signature
Message body
The message body is a JSON document that contains the following objects:
| Name | Type | Description |
|---|---|---|
offset | integer | Starting index of the returned rows. |
rows | array | Array 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_rows | integer | Number of documents in the database.This number is not the number of rows returned. |
update_seq | integer | Sequence 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
}