AccumulationOperators
DSL to accumulate values into each other, available in the $group stage.
Accumulation operators are a specific type of aggregation operators.
Operators
Arithmetic operators:
See also
Representation of an aggregation value.
Learn more about regular aggregation operators.
Properties
The strategy used when converting from KProperty1 to Field.
Returns the number of code points in the specified string.
Returns the number of UTF-8 encoded bytes in the specified string.
Functions
The absolute value of a number.
Adds a new node as a child of this one.
Adds any number of nodes into this one.
Calculates and returns the collective average of numeric values. Non-numeric values are ignored.
Returns the average of the elements in the array.
The smallest integer greater than or equal to the specified value.
Concatenates strings together.
Decides between two values depending on the evaluation of a boolean value.
Divides one aggregation value by another.
Refers to field as a nested field of the current value.
Refers to child as a nested field of the current field.
Compares two aggregation values and returns true if they are equivalent.
Selects a subset of an array to return based on the specified predicate, similarly to Kotlin's filter.
The largest integer less than or equal to the specified value.
Makes this expression immutable.
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
Applies a transform to all elements in an array and returns the array with the applied results, similar to kotlin.collections.map.
Returns an approximation of the median, the 50th percentile, as a scalar value.
Subtracts one aggregation value from another.
Compares two aggregation values and returns true if they are not equivalent.
Refers to a Kotlin value within an aggregation value.
Refers to a field within an aggregation value.
Refers to a BsonType within an aggregation value.
Returns an approximation of the specified percentiles.
Sums two aggregation values.
Replaces all instances of find with a replacement string.
Replaces the first instance of find with a replacement string.
Returns a simplified (but equivalent) expression to the current expression.
Sorts an array based on its elements, in ascending order.
Sorts an array based on fields of its elements.
Sorts an array based on its elements, in descending order.
Divides a string into an array of substrings based on a delimiter.
Returns the substring of a string.
Returns the substring of a string.
Calculates and returns the collective sum of numeric values. Non-numeric values are ignored.
Selects one value based on multiple conditions.
Returns the first limit elements in an array, similar to kotlin.collections.take.
Returns the last limit elements in an array, similar to kotlin.collections.takeLast.
Multiplies two or more aggregation values.
Writes the result of simplifying to a new BsonDocument.
Converts this value to a BsonType.Double.
Converts this value to an Int (BsonType.Int32).
Converts this value to an Long (BsonType.Int64).
Removes whitespace characters, including null, or the specified characters from the beginning and end of a string.
Removes the specified characters from the beginning and end of a string.
Removes whitespace characters, including null, or the specified characters from the end of a string.
Removes the specified characters from the end of a string.
Removes whitespace characters, including null, or the specified characters from the beginning of a string.
Removes the specified characters from the beginning of a string.
Writes the result of simplifying this expression into writer.