maxN

fun <InExpression, NExpression> maxN(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 {@code N} largest values of the given {@code inExpression}, where {@code N} is the positive integral value of the {@code nExpression}.

Return

The requested {@link BsonField}. @mongodb.driver.manual reference/operator/aggregation/maxN/ $maxN

Since

4.7 @mongodb.server.release 5.2

Parameters

property

The data class property computed by the accumulator.

inExpression

The input expression.

nExpression

The expression limiting the number of produced values.

The type of the limiting expression.