singleOrNull

fun <T> MongoIterable<T>.singleOrNull(): T?

Returns single element, or null if the collection is empty or has more than one element.


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

Returns the single element matching the given predicate, or null if element was not found or more than one element was found.