Package dev.morphia.query
Class BucketOptions.OutputOperation
- java.lang.Object
-
- dev.morphia.query.BucketOptions.OutputOperation
-
- Enclosing class:
- BucketOptions
public class BucketOptions.OutputOperation extends Object
Defines an output for bucketauto stage, that consists of the fieldname and the accumulator
-
-
Constructor Summary
Constructors Constructor Description OutputOperation(String fieldName)
Creates the output operation for given fieldname
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BucketOptions
addToSet(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(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(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.
-
-
-
Constructor Detail
-
OutputOperation
public OutputOperation(String fieldName)
Creates the output operation for given fieldname- Parameters:
fieldName
- name of the output field
-
-
Method Detail
-
addToSet
public BucketOptions addToSet(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
- Aggregration Expression: $addToSet
-
average
public BucketOptions average(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
- Aggregration Expression: $avg
-
sum
public BucketOptions sum(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
- Aggregration Expression: $sum
-
-