kmongo / kotlin.collections / com.mongodb.client.MongoIterable / firstOrNull

firstOrNull

fun <T> MongoIterable<T>.firstOrNull(): T? (source)

Returns the first element, or null if the collection is empty.

inline fun <T> MongoIterable<T>.firstOrNull(crossinline predicate: (T) -> Boolean): T? (source)

Returns the first element matching the given predicate, or null if element was not found.