Function aggregate

  • Return the result collection after running the aggregation pipeline for the given collection. Shorthand for (new Aggregator(pipeline, options)).run(collection)

    Parameters

    • collection: Source

      array or stream of objects

    • pipeline: AnyObject[]

      The pipeline operators to use

    • Optionaloptions: Partial<Options>

    Returns AnyObject[]

    New array of results