find

fun <T : Any> MongoCollection<T>.find(filter: String = KMongoUtil.EMPTY_JSON): FindIterable<T>

Finds all documents in the collection.

Return

the find iterable interface

Parameters

filter

the query filter


fun <T : Any> MongoCollection<T>.find(vararg filters: Bson?): FindIterable<T>

Finds all documents in the collection.

Return

the find iterable interface

Parameters

filters

the query filters


fun <T : Any> MongoCollection<T>.find(clientSession: ClientSession, filter: String = KMongoUtil.EMPTY_JSON): FindIterable<T>

Finds all documents in the collection.

Return

the find iterable interface

Parameters

clientSession

the client session with which to associate this operation

filter

the query filter


fun <T : Any> MongoCollection<T>.find(clientSession: ClientSession, vararg filters: Bson?): FindIterable<T>

Finds all documents in the collection.

Return

the find iterable interface

Parameters

clientSession

the client session with which to associate this operation

filters

the query filters


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

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