fun <T> MongoIterable<T>.singleOrNull(): T?
(source)
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?
(source)
Returns the single element matching the given predicate, or null
if element was not found or more than one element was found.