compact

Removes information between two proven versions of the database

Definition

compact allows the compaction of data between two proven database versions.

The compact command has the following form:

{
    "compact"  : {
        "startVersion" : <number>,
        "endVersion" : <number>
    }
}

The command accepts the following fields:

FieldTypeMandatory
compact.startVersionnumberyes
compact.endVersionnumberyes

Output

The returned document contains a subset of the following fields:

FieldTypeDescription
oknumberThe status of the command.
proofsDeletednumberThe number of proofs deleted.
versionsDeletednumberThe number of versions deleted.
documentsDeleteddocumentThe number of documents deleted in the specified collections.

Examples

Compact between two versions

The following command compacts documents between versions 100 and 200.

{
    "compact" : {
        "startVersion" : 100,
        "endVersion" : 200
    }
}

The response would be the following:

{
    "ok" : 1,
    "proofsDeleted" : NumberLong(0),
    "versionsDeleted" : NumberLong(8),
    "documentsDeleted" : {
        "totalDocuments" : NumberLong(24),
        "compactable7093681" : NumberLong(24)
    }
}

What’s Next