Class Group


  • @Deprecated(since="2.0",
                forRemoval=true)
    public final class Group
    extends Object
    Deprecated, for removal: This API element is subject to removal in a future version.
    use Group instead
    Defines a group pipeline stage.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static Accumulator addToSet​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
      static Accumulator average​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
      static Accumulator first​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the value that results from applying an expression to the first document in a group of documents that share the same group by key.
      Accumulator getAccumulator()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      String getName()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      Group getNested()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      List<Projection> getProjections()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      String getSourceField()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      static Group grouping​(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a named grouping
      static Group grouping​(String name, Accumulator accumulator)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a named grouping on a field
      static Group grouping​(String name, Group group)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a named grouping
      static Group grouping​(String name, Projection... projections)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a named grouping
      static Group grouping​(String name, String sourceField)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a named grouping on a field
      static List<Group> id​(Group... fields)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a group of Groups for use as an ID
      static Accumulator last​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the value that results from applying an expression to the last document in a group of documents that share the same group by a field.
      static Accumulator max​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the highest value that results from applying an expression to each document in a group of documents that share the same group by key.
      static Accumulator min​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the lowest value that results from applying an expression to each document in a group of documents that share the same group by key.
      static Accumulator push​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns an array of all values that result from applying an expression to each document in a group of documents that share the same group by key.
      static Accumulator sum​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
    • Method Detail

      • id

        public static List<Group> id​(Group... fields)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Create a group of Groups for use as an ID
        Parameters:
        fields - the Groups to group
        Returns:
        the Group
      • grouping

        public static Group grouping​(String name)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a named grouping
        Parameters:
        name - the field name
        Returns:
        the Group
      • grouping

        public static Group grouping​(String name,
                                     String sourceField)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a named grouping on a field
        Parameters:
        name - the group name
        sourceField - the field name
        Returns:
        the Group
      • grouping

        public static Group grouping​(String name,
                                     Projection... projections)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a named grouping
        Parameters:
        name - the field name
        projections - the fields to create
        Returns:
        the Group
      • grouping

        public static Group grouping​(String name,
                                     Group group)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a named grouping
        Parameters:
        name - the field name
        group - the fields to create
        Returns:
        the Group
      • grouping

        public static Group grouping​(String name,
                                     Accumulator accumulator)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a named grouping on a field
        Parameters:
        name - the group name
        accumulator - the Accumulator to apply to the field
        Returns:
        the Group
      • addToSet

        public static Accumulator addToSet​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Aggregration Expression: $addToSet
      • average

        public static Accumulator average​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Aggregration Expression: $avg
      • first

        public static Accumulator first​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the value that results from applying an expression to the first document in a group of documents that share the same group by key. Only meaningful when documents are in a defined order.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        Aggregration Expression: $first
      • last

        public static Accumulator last​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the value that results from applying an expression to the last document in a group of documents that share the same group by a field. Only meaningful when documents are in a defined order.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        Aggregration Expression: $last
      • max

        public static Accumulator max​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the highest value that results from applying an expression to each document in a group of documents that share the same group by key.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        Aggregration Expression: $max
      • min

        public static Accumulator min​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the lowest value that results from applying an expression to each document in a group of documents that share the same group by key.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        Aggregration Expression: $min
      • push

        public static Accumulator push​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns an array of all values that result from applying an expression to each document in a group of documents that share the same group by key.
        Parameters:
        field - the field to process
        Returns:
        an Accumulator
        MongoDB documentation
        Aggregration Expression: $push
      • sum

        public static Accumulator sum​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Aggregration Expression: $sum
      • getAccumulator

        public Accumulator getAccumulator()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the accumulator for this Group
      • getName

        public String getName()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the name of the group
      • getNested

        public Group getNested()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the nested group
      • getProjections

        public List<Projection> getProjections()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the projections for the group
      • getSourceField

        public String getSourceField()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the source field for the group