Accumulator

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def addToSet[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing all unique values that results from applying the given expression to each document in a group of documents that share the same group by key.

Gets a field name for a $group operation representing all unique values that results from applying the given expression to each document in a group of documents that share the same group by key.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/addToSet/

def avg[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the average of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the average of the values of the given expression when applied to all members of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/avg/

def combinedWith(anotherAccumulator: Accumulator): Accumulator

Merges 2 field accumulators together.

Merges 2 field accumulators together.

Value Params
anotherAccumulator

the accumulator to be merged with

Returns

the accumulator

def first[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the value of the given expression when applied to the first member of the group.

Gets a field name for a $group operation representing the value of the given expression when applied to the first member of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/first/

def last[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the value of the given expression when applied to the last member of the group.

Gets a field name for a $group operation representing the value of the given expression when applied to the last member of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/last/

def max[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the maximum of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the maximum of the values of the given expression when applied to all members of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/max/

def min[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the minimum of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the minimum of the values of the given expression when applied to all members of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/min/

def push[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing an array of all values that results from applying an expression to each document in a group of documents that share the same group by key.

Gets a field name for a $group operation representing an array of all values that results from applying an expression to each document in a group of documents that share the same group by key.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/push/

def stdDevPop[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.

Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/stdDevPop/

Since

3.2

def stdDevSamp[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.

Use if the values encompass a sample of a population of data from which to generalize about the population.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/stdDevSamp/

def sum[T](fieldName: String, expression: T): Accumulator

Gets a field name for a $group operation representing the sum of the values of the given expression when applied to all members of the group.

Gets a field name for a $group operation representing the sum of the values of the given expression when applied to all members of the group.

Value Params
expression

the expression https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#std-label-aggregation-expressions

fieldName

the field name

Returns

the accumulator https://docs.mongodb.com/manual/reference/operator/aggregation/sum/