Operations: How to Get Collection Statistics

GetCollectionStatisticsOperation is used to return total count of documents, conflicts and document count in each collection.

Syntax

public GetCollectionStatisticsOperation()

public class CollectionStatistics {

    private int countOfDocuments;
    private int countOfConflicts;
    private Map<String, Long> collections;

    public CollectionStatistics() {
        collections = new HashMap<>();
    }

    public Map<String, Long> getCollections() {
        return collections;
    }

    public void setCollections(Map<String, Long> collections) {
        this.collections = collections;
    }

    public int getCountOfDocuments() {
        return countOfDocuments;
    }

    public void setCountOfDocuments(int countOfDocuments) {
        this.countOfDocuments = countOfDocuments;
    }

    public int getCountOfConflicts() {
        return countOfConflicts;
    }

    public void setCountOfConflicts(int countOfConflicts) {
        this.countOfConflicts = countOfConflicts;
    }
}
Return Value
CountOfDocuments int Total documents count
CountOfConflicts int Total conflicts count
Collections Map<String, long> Maps collection name to document count

Example

CollectionStatistics stats = store.maintenance().send(new GetCollectionStatisticsOperation());