limit

open fun limit(limit: Int)(source)

The maximum number of matching documents to return.

Example

class User(
val name: String,
val age: Int,
)

collection.find(
options = { limit(5) }
) {
User::age eq 10
}

open fun limit(limit: Long)(source)

The maximum number of matching documents to return.

Example

class User(
val name: String,
val age: Int,
)

collection.find(
options = { limit(5) }
) {
User::age eq 10
}

Note that not all drivers support specifying a limit larger than an Int.