bottom N
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}.
Return
The requested {@link BsonField}. @mongodb.driver.manual reference/operator/aggregation/bottomN/ $bottomN
Since
4.7 @mongodb.server.release 5.2
Parameters
property
The data class property computed by the accumulator.
sort By
The {@linkplain Sorts sort specification}. The syntax is identical to the one expected by {@link Aggregates#sort(Bson)}.
out Expression
The output expression.
n Expression
The expression limiting the number of produced values.