UNPKG

977 BTypeScriptView Raw
1import { Options } from "./core";
2import { Iterator, Source } from "./lazy";
3import { Collection, 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 readonly pipeline: Array<RawObject>;
13 readonly options?: Options;
14 constructor(pipeline: Array<RawObject>, options?: Options);
15 /**
16 * Returns an `Lazy` iterator for processing results of pipeline
17 *
18 * @param {*} collection An array or iterator object
19 * @param {Query} query the `Query` object to use as context
20 * @returns {Iterator} an iterator object
21 */
22 stream(collection: Source): Iterator;
23 /**
24 * Return the results of the aggregation as an array.
25 *
26 * @param {*} collection
27 * @param {*} query
28 */
29 run(collection: Source): Collection;
30}