accumulator

fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String): BsonField

Creates an $accumulator pipeline stage

Return

the $accumulator pipeline stage @mongodb.driver.manual reference/operator/aggregation/accumulator/ $accumulator @mongodb.server.release 4.4

Parameters

property

the data class property

initFunction

a function used to initialize the state

accumulateFunction

a function used to accumulate documents

mergeFunction

a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.


fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String, finalizeFunction: String?): BsonField

Creates an $accumulator pipeline stage

Return

the $accumulator pipeline stage @mongodb.driver.manual reference/operator/aggregation/accumulator/ $accumulator @mongodb.server.release 4.4

Parameters

property

the data class property

initFunction

a function used to initialize the state

accumulateFunction

a function used to accumulate documents

mergeFunction

a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.

finalizeFunction

a function used to finalize the state and return the result (may be null)


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

Creates an $accumulator pipeline stage

Return

the $accumulator pipeline stage @mongodb.driver.manual reference/operator/aggregation/accumulator/ $accumulator @mongodb.server.release 4.4

Parameters

property

the data class property

initFunction

a function used to initialize the state

initArgs

init function’s arguments (may be null)

accumulateFunction

a function used to accumulate documents

accumulateArgs

additional accumulate function’s arguments (may be null). The first argument to the function is ‘state’.

mergeFunction

a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.

finalizeFunction

a function used to finalize the state and return the result (may be null)


fun <T> accumulator(property: KProperty<T>, initFunction: String, accumulateFunction: String, mergeFunction: String, finalizeFunction: String?, lang: String): BsonField

Creates an $accumulator pipeline stage

Return

the $accumulator pipeline stage @mongodb.driver.manual reference/operator/aggregation/accumulator/ $accumulator @mongodb.server.release 4.4

Parameters

property

the data class property

initFunction

a function used to initialize the state

accumulateFunction

a function used to accumulate documents

mergeFunction

a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.

finalizeFunction

a function used to finalize the state and return the result (may be null)

lang

a language specifier


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

Return

the $accumulator pipeline stage @mongodb.driver.manual reference/operator/aggregation/accumulator/ $accumulator @mongodb.server.release 4.4

Parameters

property

The data class property.

initFunction

a function used to initialize the state

initArgs

init function’s arguments (may be null)

accumulateFunction

a function used to accumulate documents

accumulateArgs

additional accumulate function’s arguments (may be null). The first argument to the function is ‘state’.

mergeFunction

a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.

finalizeFunction

a function used to finalize the state and return the result (may be null)

lang

a language specifier