UNPKG

1.41 kBTypeScriptView Raw
1import { Options } from "./core";
2import { Cursor } from "./cursor";
3import { Source } from "./lazy";
4import { Collection, RawObject } from "./types";
5/**
6 * An object used to filter input documents
7 *
8 * @param {Object} criteria The criteria for constructing predicates
9 * @param {Options} options Options for use by operators
10 * @constructor
11 */
12export declare class Query {
13 private readonly criteria;
14 private readonly options?;
15 private readonly compiled;
16 constructor(criteria: RawObject, options?: 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(obj: RawObject): 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(collection: Source, projection?: RawObject): Cursor;
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(collection: Collection): Collection;
41}