Accumulators

Accumulators extension methods to improve Kotlin interop

Since

5.3

Functions

Link copied to clipboard
fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String): BsonField
fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String, finalizeFunction: String?): BsonField
fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String, finalizeFunction: String?, lang: String): BsonField
fun <T> accumulator(property: KProperty<T>, initFunction: String, initArgs: List<String>?, accumulateFunction: String, accumulateArgs: List<String>?, mergeFunction: String, finalizeFunction: String?): BsonField
fun <T> accumulator(property: KProperty<T>, initFunction: String, initArgs: List<String>?, accumulateFunction: String, accumulateArgs: List<String>?, mergeFunction: String, finalizeFunction: String?, lang: String): BsonField

Creates an $accumulator pipeline stage

Link copied to clipboard
fun <TExpression> addToSet(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <TExpression> avg(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <OutExpression> bottom(property: KProperty<*>, sortBy: Bson, outExpression: OutExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a value of the given {@code outExpression} computed for the bottom element within a group sorted according to the provided {@code sortBy} specification.

Link copied to clipboard
fun <OutExpression, NExpression> bottomN(property: KProperty<*>, sortBy: Bson, outExpression: OutExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of values of the given {@code outExpression} computed for the bottom {@code N} elements within a group sorted according to the provided {@code sortBy} specification, where {@code N} is the positive integral value of the {@code nExpression}.

Link copied to clipboard
fun <TExpression> first(property: KProperty<*>, expression: TExpression): BsonField

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

Link copied to clipboard
fun <InExpression, NExpression> firstN(property: KProperty<*>, inExpression: InExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of values of the given {@code inExpression} computed for the first {@code N} elements within a presorted group, where {@code N} is the positive integral value of the {@code nExpression}.

Link copied to clipboard
fun <TExpression> last(property: KProperty<*>, expression: TExpression): BsonField

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

Link copied to clipboard
fun <InExpression, NExpression> lastN(property: KProperty<*>, inExpression: InExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of values of the given {@code inExpression} computed for the last {@code N} elements within a presorted group, where {@code N} is the positive integral value of the {@code nExpression}.

Link copied to clipboard
fun <TExpression> max(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <InExpression, NExpression> maxN(property: KProperty<*>, inExpression: InExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of {@code N} largest values of the given {@code inExpression}, where {@code N} is the positive integral value of the {@code nExpression}.

Link copied to clipboard
fun <InExpression> median(property: KProperty<*>, inExpression: InExpression, method: QuantileMethod): BsonField

Returns a combination of a computed field and an accumulator that generates a BSON {@link org.bson.BsonType#DOUBLE Double } representing the median value computed from the given {@code inExpression} within a group.

Link copied to clipboard
fun <TExpression> mergeObjects(property: KProperty<*>, expression: TExpression): BsonField

Gets a field name for a $group operation representing the result of merging the fields of the documents. If documents to merge include the same field name, the field, in the resulting document, has the value from the last document merged for the field.

Link copied to clipboard
fun <TExpression> min(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <InExpression, NExpression> minN(property: KProperty<*>, inExpression: InExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of {@code N} smallest values of the given {@code inExpression}, where {@code N} is the positive integral value of the {@code nExpression}.

Link copied to clipboard
fun <InExpression, PExpression> percentile(property: KProperty<*>, inExpression: InExpression, pExpression: PExpression, method: QuantileMethod): BsonField

Returns a combination of a computed field and an accumulator that generates a BSON {@link org.bson.BsonType#ARRAY Array} containing computed values from the given {@code inExpression} based on the provided {@code pExpression}, which represents an array of percentiles of interest within a group, where each element is a numeric value between 0.0 and 1.0 (inclusive).

Link copied to clipboard
fun <TExpression> push(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <TExpression> stdDevPop(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <TExpression> stdDevSamp(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <TExpression> sum(property: KProperty<*>, expression: TExpression): BsonField

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.

Link copied to clipboard
fun <OutExpression> top(property: KProperty<*>, sortBy: Bson, outExpression: OutExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a value of the given {@code outExpression} computed for the top element within a group sorted according to the provided {@code sortBy} specification.

Link copied to clipboard
fun <OutExpression, NExpression> topN(property: KProperty<*>, sortBy: Bson, outExpression: OutExpression, nExpression: NExpression): BsonField

Returns a combination of a computed field and an accumulator that produces a BSON {@link org.bson.BsonType#ARRAY Array} of values of the given {@code outExpression} computed for the top {@code N} elements within a group sorted according to the provided {@code sortBy} specification, where {@code N} is the positive integral value of the {@code nExpression}.