Configure Conflict Revisions Operation
-
By default, RavenDB creates revisions for conflict documents for all collections
when conflicts occur and when they are resolved. -
Use
ConfigureRevisionsForConflictsOperation
to disable the feature or modify the configuration. -
If you define default configuration,
then these settings will override the conflict revisions configuration. -
If you define any collection-specific configuration,
then these settings will also override the conflict revisions configuration for that collection.- E.g., if the conflict revisions configuration defines that revisions created for conflicting documents will not be purged,
but a collection-specific configuration defines an age limit for revisions,
revisions for conflicting documents of this collection that exceed this age will be purged.
- E.g., if the conflict revisions configuration defines that revisions created for conflicting documents will not be purged,
but a collection-specific configuration defines an age limit for revisions,
-
In this page:
Configure revisions for conflicts - Example
// Define the settings that will apply for conflict revisions (for all collections)
const conflictRevConfig = new RevisionsCollectionConfiguration();
conflictRevConfig.minimumRevisionAgeToKeep = TimeUtil.millisToTimeSpan(3600 * 1000 * 24 * 45) // 45 days
conflictRevConfig.purgeOnDelete = true;
// With this configuration:
// ------------------------
// * A revision will be created for conflict documents
// * When the parent document is deleted all its revisions will be removed.
// * Revisions that exceed 45 days will be removed on next revision creation.
// Define the configure conflict revisions operation, pass the configuration
const configureConflictRevisionsOp =
new ConfigureRevisionsForConflictsOperation(documentStore.database, conflictRevConfig);
// Execute the operation by passing it to maintenance.server.send
// The existing conflict revisions configuration will be replaced by the configuration passed
await documentStore.maintenance.server.send(configureConflictRevisionsOp);
Syntax
const configureRevisionsOp = new ConfigureRevisionsForConflictsOperation(database, configuration);
Parameter | Type | Description |
---|---|---|
database | string |
The name of the database whose conflict revisions you want to manage |
configuration | RevisionsCollectionConfiguration |
The conflict revisions configuration to apply |
class RevisionsCollectionConfiguration
{
minimumRevisionsToKeep;
minimumRevisionAgeToKeep;
maximumRevisionsToDeleteUponDocumentUpdate;
purgeOnDelete;
disabled;
}
- See properties explanation and default values here.
Storage consideration
Automatic creation of conflict revisions can help track document conflicts and understand their reasons.
However, it can also lead to a significant increase in the database size if many conflicts occur unexpectedly.
-
Consider limiting the number of conflict revisions kept per document using:
minimumRevisionsToKeep
and/orminimumRevisionAgeToKeep
. -
Revisions are purged upon modification of their parent documents.
If you want to purge a large number of revisions at once, you can cautiously enforce configuration.