Class Accumulator


  • public class Accumulator
    extends Object
    Defines an accumulator for use in an aggregation pipeline.
    • Constructor Detail

      • Accumulator

        public Accumulator​(String operation,
                           String field)
        Defines an accumulator for use in an aggregation pipeline.
        Parameters:
        operation - the accumulator operation
        field - the field to use
      • Accumulator

        public Accumulator​(String operation,
                           Object field)
        Defines an accumulator for use in an aggregation pipeline.
        Parameters:
        operation - the accumulator operation
        field - the field to use
    • Method Detail

      • accumulator

        public static Accumulator accumulator​(String operation,
                                              String field)
        Defines an accumulator for use in an aggregation pipeline.
        Parameters:
        operation - the accumulator operation
        field - the field to use
        Returns:
        an Accumulator
      • accumulator

        public static Accumulator accumulator​(String operation,
                                              Object field)
        Defines an accumulator for use in an aggregation pipeline.
        Parameters:
        operation - the accumulator operation
        field - the field to use
        Returns:
        an Accumulator
      • getOperation

        public String getOperation()
        Returns:
        the operation for this accumulator
      • getValue

        public Object getValue()
        Returns:
        the value for this accumulator
      • toDocument

        public org.bson.Document toDocument()