kmongo / org.litote.kmongo / com.mongodb.client.MongoCollection / mapReduce

mapReduce

fun <reified TResult : Any> MongoCollection<*>.mapReduce(mapFunction: String, reduceFunction: String): MapReduceIterable<TResult> (source)

Aggregates documents according to the specified map-reduce function.

Parameters

mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.

reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.

Parameters

Return
an iterable containing the result of the map-reduce operation

fun <reified TResult : Any> MongoCollection<*>.mapReduce(clientSession: ClientSession, mapFunction: String, reduceFunction: String): MapReduceIterable<TResult> (source)

Aggregates documents according to the specified map-reduce function.

Parameters

clientSession - the client session with which to associate this operation

mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.

reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.

Parameters

Return
an iterable containing the result of the map-reduce operation