Skip to content

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

Package-level declarations

Declaration and implementation of collections and iterables.

Types

JvmMongoCollection

Implementation of MongoCollection based on MongoDB's MongoCollection.

JvmMongoIterable

Implementation of MongoIterable based on MongoDB's FindFlow.

LazyMongoIterable

MongoAggregationPipeline

MongoCollection

Methods to interact with a MongoDB collection.

MongoIterable

interface MongoIterable<Document : Any>

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

Functions

asFlow

asIterable

asKtMongo

Converts a MongoDB FindFlow into a KtMongo MongoIterable.

fun <Document : Any> MongoCollection<Document>.asKtMongo(): JvmMongoCollection<Document>

Converts a MongoDB collection into a KtMongo collection.

filter

Returns a filtered collection that only contains the elements that match filter.

first

inline suspend fun <Document : Any> LazyMongoIterable<Document>.first(): Document

firstOrNull

forEach

inline suspend fun <Document : Any> LazyMongoIterable<Document>.forEach(noinline action: suspend (Document) -> Unit)

toList

inline suspend fun <Document : Any> LazyMongoIterable<Document>.toList(): List<Document>

toSet

inline suspend fun <Document : Any> LazyMongoIterable<Document>.toSet(): Set<Document>