Package dev.morphia.aggregation
Class Group
- java.lang.Object
-
- dev.morphia.aggregation.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.useGroupinsteadDefines a group pipeline stage.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AccumulatoraddToSet(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 Accumulatoraverage(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 Accumulatorfirst(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.AccumulatorgetAccumulator()Deprecated, for removal: This API element is subject to removal in a future version.StringgetName()Deprecated, for removal: This API element is subject to removal in a future version.GroupgetNested()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.StringgetSourceField()Deprecated, for removal: This API element is subject to removal in a future version.static Groupgrouping(String name)Deprecated, for removal: This API element is subject to removal in a future version.Creates a named groupingstatic Groupgrouping(String name, Accumulator accumulator)Deprecated, for removal: This API element is subject to removal in a future version.Creates a named grouping on a fieldstatic Groupgrouping(String name, Group group)Deprecated, for removal: This API element is subject to removal in a future version.Creates a named groupingstatic Groupgrouping(String name, Projection... projections)Deprecated, for removal: This API element is subject to removal in a future version.Creates a named groupingstatic Groupgrouping(String name, String sourceField)Deprecated, for removal: This API element is subject to removal in a future version.Creates a named grouping on a fieldstatic 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 IDstatic Accumulatorlast(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 Accumulatormax(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 Accumulatormin(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 Accumulatorpush(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 Accumulatorsum(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
-
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
-
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 namesourceField- 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 nameprojections- 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 namegroup- 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 nameaccumulator- the Accumulator to apply to the field- Returns:
- the Group
-
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
-
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
@Nullable 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
@Nullable public Group getNested()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the nested group
-
getProjections
@Nullable 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
-
-