kmongo / org.litote.kmongo.coroutine / CoroutineCollection / findOne

findOne

suspend fun findOne(filter: String = KMongoUtil.EMPTY_JSON): T? (source)
suspend fun findOne(filter: Bson): T? (source)

Finds the first document that match the filter in the collection.

Parameters

filter - the query filter

suspend fun findOne(clientSession: ClientSession, filter: String = KMongoUtil.EMPTY_JSON): T? (source)
suspend fun findOne(clientSession: ClientSession, filter: Bson = EMPTY_BSON): T? (source)

Finds the first document that match the filter in the collection.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter

suspend fun findOne(vararg filters: Bson?): T? (source)

Finds the first document that match the filters in the collection.

Parameters

filters - the query filters

Return
the first item returned or null