firstN

fun <InExpression, NExpression> firstN(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 first {@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/firstN/ $firstN @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.