setMaxRevTreeDepth not working as intended after Compaction is called

Hi Folks,

1)Set DB setMaxRevTreeDepth to 3.
2)UPSERT a documents 10 times.
3)Rev size now is 10.
4)Call Compaction on the DB.

in revs table The the old revision ids are maintained and last revision has the json body.
only 3 Revisions with with 3 json body.


  • Set the maximum depth of a document’s revision tree (or, max length of its revision history.)
  • Revisions older than this limit will be deleted during a -compact: operation.
  • Smaller values save space, at the expense of making document conflicts somewhat more likely.
    protected void setMaxRevTreeDepth(int maxRevTreeDepth) {
    if (store != null)


  • Compacts the database file by purging non-current JSON bodies, pruning revisions older than
  • the maxRevTreeDepth, deleting unused attachment files, and vacuuming the SQLite database.
    public void compact() throws CouchbaseLiteException {
    // Can’t delete any rows because that would lose revision tree history.
    // But we can remove the JSON of non-current revisions, which is most of the space.