first

suspend fun <T : Any> FindFlow<T>.first(): T?

Deprecated (with error)

kmongo-dsl: KMongo 4/5 first() returned null when there is no result. Use firstOrNull(), or explicitly import kotlinx.coroutines.flow.first to get the throwing variant.

Replace with

import kotlinx.coroutines.flow.firstOrNull
firstOrNull()

KMongo 4/5 CoroutineFindPublisher.first returned null if there is no result (kotlinx.coroutines.flow.first throws a NoSuchElementException).

This extension is more specific than kotlinx.coroutines.flow.first, so it would silently be selected for find(...).first() calls: it is deprecated with the ERROR level, so that each call is reviewed. An explicit import kotlinx.coroutines.flow.first takes precedence over the star import of this package.


suspend fun <T : Any> AggregateFlow<T>.first(): T?

Deprecated (with error)

kmongo-dsl: KMongo 4/5 first() returned null when there is no result. Use firstOrNull(), or explicitly import kotlinx.coroutines.flow.first to get the throwing variant.

Replace with

import kotlinx.coroutines.flow.firstOrNull
firstOrNull()

KMongo 4/5 CoroutineAggregatePublisher.first returned null if there is no result.


suspend fun <T : Any> DistinctFlow<T>.first(): T?

Deprecated (with error)

kmongo-dsl: KMongo 4/5 first() returned null when there is no result. Use firstOrNull(), or explicitly import kotlinx.coroutines.flow.first to get the throwing variant.

Replace with

import kotlinx.coroutines.flow.firstOrNull
firstOrNull()

KMongo 4/5 CoroutineDistinctPublisher.first returned null if there is no result.