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
Types
Link copied to clipboard
data class PipelineDebugReport(val stages: List<MongoAggregationPipeline.StageDebugReport>, val limit: Int)
A debug report to help understand how this pipeline behaves.
Link copied to clipboard
A debug report to help understand how a specific stage behaves.
Functions
Link copied to clipboard
Access the data of this pipeline as a MongoIterable.
Link copied to clipboard
Creates a debug report for this pipeline.
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
abstract override fun <ForeignDocument : Any> lookup(block: LookupStageOperators<Document, ForeignDocument>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun match(filter: FilterQuery<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun matchExpr(filter: AggregationOperators.() -> Value<Document, Boolean>): MongoAggregationPipeline<Document>
Link copied to clipboard
abstract override fun <Out : Any> project(block: ProjectStageOperators<Document, Out>.() -> Unit): MongoAggregationPipeline<Out>
Link copied to clipboard
Link copied to clipboard
abstract override fun <Out : Any> set(block: SetStageOperators<Document, Out>.() -> Unit): MongoAggregationPipeline<Out>
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
Link copied to clipboard
abstract override fun unset(block: UnsetStageOperators<Document>.() -> Unit): MongoAggregationPipeline<Document>
Link copied to clipboard
Link copied to clipboard