kmongo / org.litote.kmongo.rxjava2 / com.mongodb.reactivestreams.client.MongoCollection / findOne

findOne

fun <T : Any> MongoCollection<T>.findOne(filter: String = KMongoUtil.EMPTY_JSON): Maybe<T> (source)
fun <T : Any> MongoCollection<T>.findOne(filter: Bson): Maybe<T> (source)

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

Parameters

filter - the query filter

fun <T : Any> MongoCollection<T>.findOne(clientSession: ClientSession, filter: String = KMongoUtil.EMPTY_JSON): Maybe<T> (source)
fun <T : Any> MongoCollection<T>.findOne(clientSession: ClientSession, filter: Bson): Maybe<T> (source)

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

Parameters

clientSession - the client session

filter - the query filter

fun <T : Any> MongoCollection<T>.findOne(vararg filters: Bson?): Maybe<T> (source)

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

Parameters

filters - the query filters

fun <T : Any> MongoCollection<T>.findOne(clientSession: ClientSession, vararg filters: Bson?): Maybe<T> (source)

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

Parameters

clientSession - the client session

filters - the query filters