last N
fun <InExpression, NExpression> lastN(property: KProperty<*>, inExpression: InExpression, 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 inExpression} computed for the last {@code N} elements within a presorted group, where {@code N} is the positive integral value of the {@code nExpression}.
Return
The requested {@link BsonField}. @mongodb.driver.manual reference/operator/aggregation/lastN/ $lastN @mongodb.server.release 5.2
Parameters
property
The data class property computed by the accumulator.
in Expression
The input expression.
n Expression
The expression limiting the number of produced values.