MongoDB driver for Kotlin (coroutines) • opensavvy.ktmongo.coroutines • JvmMongoCollection
JvmMongoCollection¶
class JvmMongoCollection<Document : Any> : MongoCollection<Document>
Implementation of MongoCollection
based on MongoDB's MongoCollection.
To access the inner iterable, see asKotlinClient
.
To convert an existing MongoDB iterable into an instance of this class, see asKtMongo
.
Properties¶
context
¶
@LowLevelApi
open override val context: JvmBsonContext
Functions¶
aggregate
¶
open override fun aggregate(): MongoAggregationPipeline<Document>
Start an aggregation pipeline.
asKotlinClient
¶
@LowLevelApi
fun asKotlinClient(): MongoCollection<Document>
bulkWrite
¶
Performs multiple update operations in a single request.
count
¶
Counts how many documents exist in the collection.
Counts how many documents match predicate
in the collection.
countEstimated
¶
open suspend override fun countEstimated(): Long
Counts all documents in the collection.
deleteMany
¶
open suspend override fun deleteMany(options: DeleteManyOptions<Document>.() -> Unit, filter: FilterQuery<Document>.() -> Unit)
Deletes all documents that match filter
.
deleteOne
¶
Deletes the first document found that matches filter
.
drop
¶
Removes an entire collection from the database.
filter
¶
fun <Document : Any> MongoCollection<Document>.filter(filter: <Document>.() -> Unit): MongoCollection<Document>
Returns a filtered collection that only contains the elements that match filter
.
find
¶
open override fun find(): JvmMongoIterable<Document>
Finds all documents in this collection.
Finds all documents in this collection that satisfy filter
.
findOne
¶
Finds a document in this collection that satisfies filter
.
findOneAndUpdate
¶
insertMany
¶
open suspend override fun insertMany(documents: Iterable<Document>, options: InsertManyOptions<Document>.() -> Unit)
Inserts multiple documents
in a single operation.
open suspend fun insertMany(vararg documents: Document, options: InsertManyOptions<Document>.() -> Unit = {})
Inserts multiple documents
in a single operation.
insertOne
¶
Inserts a document
.