UNPKG

1.4 kBTypeScriptView Raw
1import { Options } from "./core";
2import { Cursor } from "./cursor";
3import { Source } from "./lazy";
4import { RawObject } from "./types";
5/**
6 * An object used to filter input documents
7 *
8 * @param {Object} condition The condition for constructing predicates
9 * @param {Options} options Options for use by operators
10 * @constructor
11 */
12export declare class Query {
13 private readonly condition;
14 private readonly compiled;
15 private readonly options;
16 constructor(condition: RawObject, options?: Partial<Options>);
17 private compile;
18 private processOperator;
19 /**
20 * Checks if the object passes the query criteria. Returns true if so, false otherwise.
21 *
22 * @param obj The object to test
23 * @returns {boolean} True or false
24 */
25 test<T>(obj: T): boolean;
26 /**
27 * Returns a cursor to select matching documents from the input source.
28 *
29 * @param source A source providing a sequence of documents
30 * @param projection An optional projection criteria
31 * @returns {Cursor} A Cursor for iterating over the results
32 */
33 find<T>(collection: Source, projection?: RawObject): Cursor<T>;
34 /**
35 * Remove matched documents from the collection returning the remainder
36 *
37 * @param collection An array of documents
38 * @returns {Array} A new array with matching elements removed
39 */
40 remove<T>(collection: T[]): T[];
41}