Class CollectionStats

java.lang.Object
dev.morphia.aggregation.stages.Stage
dev.morphia.aggregation.stages.CollectionStats

public class CollectionStats extends Stage
Returns statistics regarding a collection or view.
  • Method Details

    • collStats

      public static CollectionStats collStats()
      Creates a new collStats stage
      Returns:
      the new stage
      Since:
      2.2
      MongoDB documentation
      Aggregration Pipeline Stage: $collStats
    • count

      public CollectionStats count(boolean count)
      Adds the total number of documents in the collection to the return document.
      Parameters:
      count - true to include the count
      Returns:
      this
    • histogram

      public CollectionStats histogram(boolean histogram)
      Adds latency histogram information to the embedded documents in latencyStats if true.
      Parameters:
      histogram - whether to add the histogram
      Returns:
      this
    • scale

      public CollectionStats scale(Integer scale)
      Specify the scale factor (i.e. storageStats: { scale: <number> }) to use the specified scale factor for the various size data. For example, to display kilobytes rather than bytes, specify a scale value of 1024.

      If you specify a non-integer scale factor, MongoDB uses the integer part of the specified factor. For example, if you specify a scale factor of 1023.999, MongoDB uses 1023 as the scale factor.

      The scale factor does not affect those sizes that specify the unit of measurement in the field name, such as "bytes currently in the cache".

      Parameters:
      scale - the scale
      Returns:
      this