mingo
    Preparing search index...

    Class Aggregator

    The Aggregator class provides functionality to process data collections through an aggregation pipeline. It supports streaming and executing aggregation operations with customizable options.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Executes the aggregation pipeline on the provided collection and returns the resulting array.

      Type Parameters

      • T extends AnyObject

        The type of the objects in the resulting array.

      Parameters

      • collection: Source

        The input data source to run the aggregation on.

      • Optionaloptions: Options

        Optional settings to customize the aggregation behavior.

      Returns T[]

      An array of objects of type T resulting from the aggregation.

    • Processes a collection through an aggregation pipeline and returns an iterator for the transformed results.

      Parameters

      • collection: Source

        The input collection to process. This can be any source that implements the Source interface.

      • Optionaloptions: Options

        Optional configuration for processing. If not provided, the default options of the aggregator instance will be used.

      Returns Iterator

      An iterator that yields the results of the aggregation pipeline.

      Will throw an error if:

      • A pipeline stage contains more than one operator.
      • The $documents operator is not the first stage in the pipeline.
      • An unregistered pipeline operator is encountered.