kmongo / org.litote.kmongo / com.mongodb.client.MongoIterable / evaluate

evaluate

fun <T, R> MongoIterable<T>.evaluate(expression: Sequence<T>.() -> R): R (source)

Evaluates the current MongoIterable given the expression of Sequences.

The mongo cursor is closed before returning the result.

Sample:

col.find().evaluate {
   //this is a sequence evaluation
   //If the first row has a name like "Fred", only one row is loaded in memory!
   filter { it.name != "Joe" }.first()
}