UNPKG

911 BTypeScriptView Raw
1import { Options } from "./core";
2import { Iterator, Source } from "./lazy";
3import { RawObject } from "./types";
4/**
5 * Provides functionality for the mongoDB aggregation pipeline
6 *
7 * @param pipeline an Array of pipeline operators
8 * @param options An optional Options to pass the aggregator
9 * @constructor
10 */
11export declare class Aggregator {
12 private readonly pipeline;
13 private readonly options;
14 constructor(pipeline: Array<RawObject>, options?: Partial<Options>);
15 /**
16 * Returns an `Lazy` iterator for processing results of pipeline
17 *
18 * @param {*} collection An array or iterator object
19 * @returns {Iterator} an iterator object
20 */
21 stream(collection: Source): Iterator;
22 /**
23 * Return the results of the aggregation as an array.
24 *
25 * @param {*} collection
26 * @param {*} query
27 */
28 run<T extends RawObject>(collection: Source): T[];
29}