Skip to content

Aggregate

class Aggregate<Document : Any>(
    context: BsonContext, 
    val chain: PipelineChainLink, 
    val outputType: KType
) : Command, AbstractBsonNode

Aggregating over multiple documents.

Example

users.aggregate()
    .match { User::age lt 18 }
    .limit(99)

External resources

Constructors

Aggregate

constructor(
    context: BsonContext, 
    chain: PipelineChainLink, 
    outputType: KType
)

Properties

chain

context

The context used to generate this expression.

options

open override val options: Options

The options to use when sending this command.

outputType

Functions

freeze

@LowLevelApi
open override fun freeze()

Makes this node immutable.

simplify

Returns a simplified (but equivalent) expression to the current expression.

toBson

Writes the result of simplifying to a new BsonDocument.

toString

fun toString(simplified: Boolean): String

JSON representation of this expression.

override fun toString(): String

JSON representation of this expression.

writeTo

@LowLevelApi
override fun writeTo(writer: BsonFieldWriter)

Writes the result of simplifying this expression into writer.