POST /{db}/_compact

In this document

This request compacts the database. Compaction compresses the disk database file by performing the following operations:

The compaction process runs as a background process.

Request


Request headers

This request does not have any required headers.

Query parameters

This request does not use query parameters.

Message body

This request does not use a message body.

Response


Status codes

Response headers

This response uses only standard HTTP headers.

Message body

The response contains a JSON document that contains some of the following objects:

NameTypeDescription
errorStringError message
okBooleanIndicates whether the operation was successful
statusIntegerHTTP error code

Example


The following example requests the database named cookbook to be compacted.

Request

POST /cookbook/_compact HTTP/1.1
Host: localhost:59840

Response

HTTP/1.1 202 Accepted
Accept-Ranges: bytes
Content-Length: 18
Content-Type: application/json
Date: Mon, 16 Dec 2013 17:22:34 GMT
Server: CouchbaseLite 1.486
{
  "ok" : true
}