kmongo / org.litote.kmongo.reactor / com.mongodb.reactivestreams.client.MongoCollection / aggregate

aggregate

fun <reified TResult : Any> MongoCollection<*>.aggregate(vararg pipeline: String): AggregateFlux<TResult> (source)
fun <reified TResult : Any> MongoCollection<*>.aggregate(vararg pipeline: Bson): AggregateFlux<TResult> (source)

Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.

Parameters

pipeline - the aggregate pipeline

Parameters

Return
an iterable containing the result of the aggregation operation

fun <reified TResult : Any> MongoCollection<*>.aggregate(clientSession: ClientSession, vararg pipeline: String): AggregateFlux<TResult> (source)
fun <reified TResult : Any> MongoCollection<*>.aggregate(clientSession: ClientSession, vararg pipeline: Bson): AggregateFlux<TResult> (source)

Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.

Parameters

clientSession - the client session

pipeline - the aggregate pipeline

Parameters

Return
an iterable containing the result of the aggregation operation