Skip to content

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

MongoIterable

interface MongoIterable<Document : Any>

Streaming-ready iterable client to read data from the database.

Inheritors

  • JvmMongoIterable

Functions

asFlow

abstract fun asFlow(): <Document>

Streams the results of this response into a Flow.

asSequence

open fun asSequence(): <Document>

first

open suspend fun first(): Document

Returns the first document found by this query, or throws an exception.

firstOrNull

abstract suspend fun firstOrNull(): Document?

Returns the first document found by this query, or null if none were found.

forEach

abstract suspend fun forEach(action: suspend (Document) -> Unit)

Executes action for each document returned by this query.

toList

open suspend fun toList(): List<Document>

Reads the entirety of this response into a List.

toSequence

open fun toSequence(): <Document>

toSet

open suspend fun toSet(): Set<Document>

Reads the entirety of this response into a Set.