UNPKG

1.75 kBTypeScriptView Raw
1import "./init/basic";
2import { Aggregator } from "./aggregator";
3import { Options } from "./core";
4import { Cursor } from "./cursor";
5import { Source } from "./lazy";
6import { Query } from "./query";
7import { RawObject } from "./types";
8export { Aggregator } from "./aggregator";
9export { Query } from "./query";
10/**
11 * Performs a query on a collection and returns a cursor object.
12 * Shorthand for `Query(criteria).find(collection, projection)`
13 *
14 * @param collection Array of objects
15 * @param criteria Query criteria
16 * @param projection Projection criteria
17 * @param options
18 * @returns {Cursor} A cursor of results
19 */
20export declare function find<T>(collection: Source, criteria: RawObject, projection?: RawObject, options?: Partial<Options>): Cursor<T>;
21/**
22 * Returns a new array without objects which match the criteria
23 *
24 * @param collection Array of objects
25 * @param criteria Query criteria of objects to remove
26 * @param options
27 * @returns {Array} New filtered array
28 */
29export declare function remove(collection: RawObject[], criteria: RawObject, options?: Options): RawObject[];
30/**
31 * Return the result collection after running the aggregation pipeline for the given collection.
32 * Shorthand for `(new Aggregator(pipeline, options)).run(collection)`
33 *
34 * @param collection array or stream of objects
35 * @param pipeline The pipeline operators to use
36 * @param options
37 * @returns {Array} New array of results
38 */
39export declare function aggregate(collection: Source, pipeline: RawObject[], options?: Partial<Options>): RawObject[];
40declare const _default: {
41 Aggregator: typeof Aggregator;
42 Query: typeof Query;
43 aggregate: typeof aggregate;
44 find: typeof find;
45 remove: typeof remove;
46};
47export default _default;