MongoAggregationPipeline
A multi-stage aggregation pipeline that transforms documents from a MongoDB collection.
Pipelines are immutable. Each stage method returns a new pipeline with the stage appended.
To obtain a pipeline, use MongoCollection.aggregate.
Example
class User(
val name: String,
val age: Int,
)
users.aggregate()
.match { User::age gt 18 }
.sort { ascending(User::name) }
.toList()Content copied to clipboard
External resources
Functions
Link copied to clipboard
Access the data of this pipeline as a MongoIterable.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns the first document found by this query, or returns null.
Link copied to clipboard
abstract override fun <Out : Any> group(block: GroupStageOperators<Document, Out>.() -> Unit): MongoAggregationPipeline<Out>
Link copied to clipboard
Link copied to clipboard
open fun <ForeignDocument : Any> lookup(block: LookupStageOperators<Document, ForeignDocument>.() -> Unit): Pipeline<Document>
Link copied to clipboard
abstract override fun match(filter: FilterQuery<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun project(block: ProjectStageOperators<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract override fun set(block: SetStageOperators<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
Link copied to clipboard
abstract override fun sort(block: SortOptionDsl<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun unionWith(other: HasUnionWithCompatibility<Document>): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun unset(block: UnsetStageOperators<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
Link copied to clipboard