Method | GET /db/_all_docs | |
Request | None | |
Response | JSON object containing document information, ordered by the document ID | |
Admin Privileges Required | no | |
Query Arguments | Argument | descending |
Description | Return the documents in descending by key order | |
Optional | yes | |
Type | boolean | |
Default | false | |
Argument | endkey | |
Description | Stop returning records when the specified key is reached | |
Optional | yes | |
Type | string | |
Argument | endkey_docid | |
Description | Stop returning records when the specified document ID is reached | |
Optional | yes | |
Type | string | |
Argument | group | |
Description | Group the results using the reduce function to a group or single row | |
Optional | yes | |
Type | boolean | |
Default | false | |
Argument | group_level | |
Description | Specify the group level to be used | |
Optional | yes | |
Type | numeric | |
Argument | include_docs | |
Description | Include the full content of the documents in the return | |
Optional | yes | |
Type | boolean | |
Default | false | |
Argument | inclusive_end | |
Description | Specifies whether the specified end key should be included in the result | |
Optional | yes | |
Type | boolean | |
Default | true | |
Argument | key | |
Description | Return only documents that match the specified key | |
Optional | yes | |
Type | string | |
Argument | limit | |
Description | Limit the number of the returned documents to the specified number | |
Optional | yes | |
Type | numeric | |
Argument | reduce | |
Description | Use the reduction function | |
Optional | yes | |
Type | boolean | |
Default | true | |
Argument | skip | |
Description | Skip this number of records before starting to return the results | |
Optional | yes | |
Type | numeric | |
Default | 0 | |
Argument | stale | |
Description | Allow the results from a stale view to be used | |
Optional | yes | |
Type | string | |
Default | ||
Supported Values | ||
ok | Allow stale views | |
Argument | startkey | |
Description | Return records starting with the specified key | |
Optional | yes | |
Type | string | |
Argument | startkey_docid | |
Description | Return records starting with the specified document ID | |
Optional | yes | |
Type | string | |
Argument | update_seq | |
Description | Include the update sequence in the generated results | |
Optional | yes | |
Type | boolean | |
Default | false |
Returns a JSON structure of all of the documents in a given database. The information is returned as a JSON structure containing meta information about the return structure, and the list documents and basic contents, consisting the ID, revision and key. The key is generated from the document ID.
Table 5.7. All Database Documents
Field | Description |
offset | Offset where the document list started |
rows [array] | Array of document object |
total_rows | Number of documents in the database/view |
update_seq (optional) | Current update sequence for the database |
By default the information returned contains only the document ID and revision. For example, the request:
GET http://couchdb:5984/recipes/_all_docs Accept: application/json
Returns the following structure:
{ "total_rows" : 18386, "rows" : [ { "value" : { "rev" : "1-bc0d5aed1e339b1cc1f29578f3220a45" }, "id" : "Aberffrawcake", "key" : "Aberffrawcake" }, { "value" : { "rev" : "3-68a20c89a5e70357c20148f8e82ca331" }, "id" : "Adukiandorangecasserole-microwave", "key" : "Adukiandorangecasserole-microwave" }, { "value" : { "rev" : "3-9b2851ed9b6f655cc4eb087808406c60" }, "id" : "Aioli-garlicmayonnaise", "key" : "Aioli-garlicmayonnaise" }, ... ], "offset" : 0 }
The information is returned in the form of a temporary view of all the database documents, with the returned key consisting of the ID of the document. The remainder of the interface is therefore identical to the View query arguments and their behavior.