Chapter 5. CouchDB API Server Database Methods

Table of Contents

5.1. GET /db
5.2. PUT /db
5.3. DELETE /db
5.4. GET /db/_changes
5.4.1. Filtering
5.5. POST /db/_compact
5.6. POST /db/_compact/design-doc
5.7. POST /db/_view_cleanup
5.8. POST /db/_ensure_full_commit
5.9. POST /db/_bulk_docs
5.9.1. Inserting Documents in Bulk
5.9.2. Updating Documents in Bulk
5.9.3. Bulk Documents Transaction Semantics
5.9.4. Bulk Document Validation and Conflict Errors
5.10. POST /db/_temp_view
5.11. POST /db/_purge
5.11.1. Updating Indexes
5.12. GET /db/_all_docs
5.13. POST /db/_all_docs
5.14. POST /db/_missing_revs
5.15. POST /db/_revs_diff
5.16. GET /db/_security
5.17. PUT /db/_security
5.18. GET /db/_revs_limit
5.19. PUT /db/_revs_limit

The Database methods provide an interface to an entire database withing CouchDB. These are database, rather than document, level requests.

A list of the available methods and URL paths are provided below:

Table 5.1. Database API Calls

MethodPathDescription
GET/db Returns database information
PUT/db Create a new database
DELETE/db Delete an existing database
GET/db/_all_docs Returns a built-in view of all documents in this database
POST/db/_all_docs Returns certain rows from the built-in view of all documents
POST/db/_bulk_docs Insert multiple documents in to the database in a single request
GET/db/_changes Returns changes for the given database
POST/db/_compact Starts a compaction for the database
POST/db/_compact/design-doc Starts a compaction for all the views in the selected design document
POST/db/_ensure_full_commit Makes sure all uncommitted changes are written and synchronized to the disk
POST/db/_missing_revs Given a list of document revisions, returns the document revisions that do not exist in the database
POST/db/_purge Purge some historical documents entirely from database history
POST/db/_revs_diff Given a list of document revisions, returns differences between the given revisions and ones that are in the database
GET/db/_revs_limit Gets the limit of historical revisions to store for a single document in the database
PUT/db/_revs_limit Sets the limit of historical revisions to store for a single document in the database
GET/db/_security Returns the special security object for the database
PUT/db/_security Sets the special security object for the database
POST/db/_temp_view Execute a given view function for all documents and return the result
POST/db/_view_cleanup Removes view files that are not used by any design document

For all the database methods, the database name within the URL path should be the database name that you wish to perform the operation on. For example, to obtain the meta information for the database recipes, you would use the HTTP request:

GET /recipes

For clarity, the form below is used in the URL paths:

GET /db

Where db is the name of any database.