Skip to content

MongoDB driver for Kotlin (coroutines)opensavvy.ktmongo.coroutinesJvmMongoCollectionfind

find

open override fun find(): JvmMongoIterable<Document>

Finds all documents in this collection.

External resources

open override fun find(options: FindOptions<Document>.() -> Unit, filter: FilterQuery<Document>.() -> Unit): JvmMongoIterable<Document>

Finds all documents in this collection that satisfy filter.

If multiple predicates are specified, an and operator is implied.

Example

class User(
    val name: String,
    val age: Int,
)

collection.find {
    User::name eq "foo"
    User::age eq 10
}

External resources

See also

  • JvmMongoCollection.findOne When only one result is expected.