The ConfigureRevisionsOperation modifies the revisions settings for a particular database.
Within that database, each collection can have its own separate revisions
To configure the revisions settings for a database and/or the collections in that database, follow these steps:
Create a RevisionsCollectionConfiguration` object for each desired collection.
RevisionsCollectionConfiguration objects in a
Send that RevisionsConfiguration` to the server.
This object contains the four revisions settings for a particular collection:
public class RevisionsCollectionConfiguration
private boolean disabled;
private Duration minimumRevisionAgeToKeep;
private Long minimumRevisionsToKeep;
private boolean purgeOnDelete;
||The minimum number of revisions to keep per document
null - unlimited
||The minimum amount of time to keep each revision. Format of
null - unlimited
||Indicates whether to completely disable revisions for documents in this collection
||When a document is deleted, this indicates whether all of its revisions should be deleted as well
A revision is only deleted if both the
minimumRevisionsToKeep for that document is exceeded, and the revision is
older than the
minimumRevisionAgeToKeep limit. The oldest revisions are deleted first.
By default both these options are set to
null, meaning that an unlimited number of revisions will be saved
minimumRevisionsToKeep is null, revisions will be deleted only when they are older than
minimumRevisionAgeToKeep is null, revisions will be deleted each time there are more revisions than
These deletions will only take place when a new revision is added to a document. Until a new revision is added, that
document's revisions can exceed these limits.
This object contains a
Map of revision configurations for each collection in the database, plus an optional default
public class RevisionsConfiguration
private Map<String, RevisionsCollectionConfiguration> collections;
private RevisionsCollectionConfiguration defaultConfig;
||A map in which the keys are collection names, and the values are the corresponding configurations
||An optional default configuration that applies to any collection not listed in
Note that when this object is sent to the server, it overrides the configurations for all collections, including all existing
configurations currently on the server. If a collection is not listed in
defaultConfig has not been set, the
default values listed in the table above
Lastly, the operation itself sends the
RevisionsConfiguration to the server, overriding all existing collection configurations.
You'll want to store these configurations on the client-side so they don't have to be created from scratch each time you want to
public ConfigureRevisionsOperation(RevisionsConfiguration configuration);
||The new revision settings for a particular database