Limit the number of revisions in Couchdb

There's no configurable limit, primarily because CouchDB uses append-only storage, i.e. it promises to only ever write to the end of a file and never change anything in the middle. As a result a configurable limit is meaningless.

Compaction is your only option. There has been some talk about automatically triggered compaction on the mailing lists but it can only be triggered manually for now.


It is possible on a per database basis through this HTTP API:

PUT /{db}/_revs_limit

Sets the maximum number of document revisions that will be tracked by CouchDB, even after compaction has occurred. You can set the revision limit on a database with a scalar integer of the limit that you want to set as the request body.

See https://docs.couchdb.org/en/stable/api/database/misc.html#db-revs-limit

Tags:

Couchdb