Skip to content

HasSort

Pipeline implementing the $sort stage.

Inheritors

Properties

context

The context used to generate this pipeline.

Functions

reinterpret

Changes the type of the returned document, with no type-safety.

sort

open fun sort(block: SortOptionDsl<Document>.() -> Unit): Pipeline<Document>

Specifies in which order elements should be sorted.

Example

collection.aggregate()
    .sort {
        ascending(User::age)
    }
    .limit(15)
    .toList()

External resources

toString

abstract override fun toString(): String

JSON representation of this pipeline.

withStage

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

writeTo

@LowLevelApi
abstract fun writeTo(writer: BsonValueWriter)

Writes the entire pipeline into writer.