Skip to content

MongoDB driver for Kotlin (synchronous)opensavvy.ktmongo.sync.operationsFindOperationsfind

find

abstract fun find(): MongoIterable<Document>

Finds all documents in this collection.

External resources

abstract fun find(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit): MongoIterable<Document>

Finds all documents in this collection that satisfy filter.

If multiple predicates are specified, an FilterQuery.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