Revisions and Other Features

When the revisions feature is enabled, a snapshot of a document that holds Counters will include in its metadata a @counters-snapshot property, that holds all the document's counter names and values (at the time of the revision creation).
This can be useful when historic records of the documents and their counter values are needed.

How do counter operations affect revision creation

Creation of a new counter and deletion of a counter modify the parent document (documents hold their counter names in the metadata) and will trigger a revision creation.
Incrementing an existing counter does not modify the parent document and will not trigger a revision creation.


List<MetadataAsDictionary> orderRevisionsMetadata = session.advanced()
    .getMetadataFor("orders/1-A", 0, 10);

List<MetadataAsDictionary> orderCountersSnapshots = orderRevisionsMetadata
    .filter(x -> x.containsKey("@counters-snapshot"))
    .map(x -> (MetadataAsDictionary) x.get("@counters-snapshot"))