MongoDB driver for Kotlin (synchronous) • opensavvy.ktmongo.sync • MongoCollection
MongoCollection¶
interface MongoCollection<Document : Any> : FindOperations<Document> , CountOperations<Document> , UpdateOperations<Document> , DeleteOperations<Document> , CollectionOperations<Document> , InsertOperations<Document> , AggregationOperations<Document> , UpdatePipelineOperations<Document>
Methods to interact with a MongoDB collection.
Operations¶
External resources¶
Inheritors¶
Properties¶
context¶
abstract val context: ERROR CLASS: Symbol not found for BsonContext
Functions¶
aggregate¶
abstract fun aggregate(): MongoAggregationPipeline<Document>
Start an aggregation pipeline.
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¶
abstract fun countEstimated(): Long
Counts all documents in the collection.
deleteMany¶
abstract fun deleteMany(options: ERROR CLASS: Symbol not found for DeleteManyOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> 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: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit): MongoCollection<Document>
Returns a filtered collection that only contains the elements that match filter.
find¶
abstract fun find(): MongoIterable<Document>
Finds all documents in this collection.
abstract fun find(options: ERROR CLASS: Symbol not found for FindOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit): MongoIterable<Document>
Finds all documents in this collection that satisfy filter.
findOne¶
Finds a document in this collection that satisfies filter.
findOneAndUpdate¶
abstract fun findOneAndUpdate(options: ERROR CLASS: Symbol not found for UpdateOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, update: ERROR CLASS: Symbol not found for UpdateQuery.() -> Unit): Document?
insertMany¶
open fun insertMany(vararg documents: Document, options: ERROR CLASS: Symbol not found for InsertManyOptions.() -> Unit)
Inserts multiple documents in a single operation.
abstract fun insertMany(documents: Iterable<Document>, options: ERROR CLASS: Symbol not found for InsertManyOptions.() -> Unit)
Inserts multiple documents in a single operation.
insertOne¶
Inserts a document.
replaceOne¶
abstract fun replaceOne(options: ERROR CLASS: Symbol not found for ReplaceOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, document: Document)
repsertOne¶
abstract fun repsertOne(options: ERROR CLASS: Symbol not found for ReplaceOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, document: Document)
updateMany¶
abstract fun updateMany(options: ERROR CLASS: Symbol not found for UpdateOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, update: ERROR CLASS: Symbol not found for UpdateQuery.() -> Unit)
updateManyWithPipeline¶
abstract fun updateManyWithPipeline(options: ERROR CLASS: Symbol not found for UpdateOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, update: ERROR CLASS: Symbol not found for UpdateWithPipelineQuery.() -> Unit)
updateOne¶
updateOneWithPipeline¶
abstract fun updateOneWithPipeline(options: ERROR CLASS: Symbol not found for UpdateOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, update: ERROR CLASS: Symbol not found for UpdateWithPipelineQuery.() -> Unit)
upsertOne¶
upsertOneWithPipeline¶
abstract fun upsertOneWithPipeline(options: ERROR CLASS: Symbol not found for UpdateOptions.() -> Unit, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit, update: ERROR CLASS: Symbol not found for UpdateWithPipelineQuery.() -> Unit)