Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.aggregationAbstractPipelinewithStage

withStage

abstract override fun withStage(stage: BsonNode): Pipeline<Output>

Creates a new pipeline that expands on the current one by adding stage.

For usage documentation, see Pipeline.withStage.

Notes for implementors

A typical pipeline implementation will look like:

class YourPipelineType<Output : Any>(
    context: BsonContext,
    chain: PipelineChainLink,
): AbstractPipeline<Output>(context, chain) {
    // …

    override fun withStage(stage: Expression): YourPipelineType<Output> =
        YourPipelineType(context, chain.withStage(expression))

    // …
}