Class BucketOptions.OutputOperation

  • Enclosing class:
    BucketOptions

    public class BucketOptions.OutputOperation
    extends java.lang.Object
    Defines an output for bucketauto stage, that consists of the fieldname and the accumulator
    • Constructor Summary

      Constructors 
      Constructor Description
      OutputOperation​(java.lang.String fieldName)
      Creates the output operation for given fieldname
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BucketOptions addToSet​(java.lang.String field)
      Returns an array of all unique values that results from applying an expression to each document in a group of documents that share the same group by key.
      BucketOptions average​(java.lang.String field)
      Returns the average value of the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key.
      BucketOptions sum​(java.lang.Object field)
      Calculates and returns the sum of all the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OutputOperation

        public OutputOperation​(java.lang.String fieldName)
        Creates the output operation for given fieldname
        Parameters:
        fieldName - name of the output field
    • Method Detail

      • addToSet

        public BucketOptions addToSet​(java.lang.String field)
        Returns an array of all unique values that results from applying an expression to each document in a group of documents that share the same group by key. Order of the elements in the output array is unspecified.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        reference/operator/aggregation/addToSet $addToSet
      • average

        public BucketOptions average​(java.lang.String field)
        Returns the average value of the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key. $avg ignores non-numeric values.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        reference/operator/aggregation/avg $avg
      • sum

        public BucketOptions sum​(java.lang.Object field)
        Calculates and returns the sum of all the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key. $sum ignores non-numeric values.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        reference/operator/aggregation/sum $sum