findOne
open fun findOne(options: ERROR CLASS: Symbol not found for FindOptions<Document>.() -> Unit = {}, filter: ERROR CLASS: Symbol not found for FilterQuery<Document>.() -> Unit): Document?(source)
Finds a document in this collection that satisfies filter.
If multiple predicates are specified, and FilterQuery.and operator is implied.
This function doesn't check that there is exactly one value in the collection. It simply returns the first matching document it finds.
Example
class User(
val name: String,
val age: Int,
)
collection.findOne {
User::name eq "foo"
User::age eq 10
}Content copied to clipboard
See also
When multiple results are expected.