mingo
Version:
MongoDB query language for in-memory objects
52 lines (51 loc) • 1.93 kB
TypeScript
import "./init/basic";
import { Aggregator } from "./aggregator";
import { Options } from "./core";
import { Cursor } from "./cursor";
import { Source } from "./lazy";
import { Query } from "./query";
import { AnyObject } from "./types";
import { createUpdater } from "./updater";
export { Aggregator } from "./aggregator";
export { Query } from "./query";
export { createUpdater, update } from "./updater";
/**
* Performs a query on a collection and returns a cursor object.
* Shorthand for `Query(criteria).find(collection, projection)`
*
* @param collection Array of objects
* @param criteria Query criteria
* @param projection Projection criteria
* @param options
* @returns {Cursor} A cursor of results
*/
export declare function find<T>(collection: Source, criteria: AnyObject, projection?: AnyObject, options?: Partial<Options>): Cursor<T>;
/**
* Returns a new array without objects which match the criteria
*
* @param collection Array of objects
* @param criteria Query criteria of objects to remove
* @param options
* @returns {Array} New filtered array
*/
export declare function remove(collection: AnyObject[], criteria: AnyObject, options?: Options): AnyObject[];
/**
* Return the result collection after running the aggregation pipeline for the given collection.
* Shorthand for `(new Aggregator(pipeline, options)).run(collection)`
*
* @param collection array or stream of objects
* @param pipeline The pipeline operators to use
* @param options
* @returns {Array} New array of results
*/
export declare function aggregate(collection: Source, pipeline: AnyObject[], options?: Partial<Options>): AnyObject[];
declare const _default: {
Aggregator: typeof Aggregator;
Query: typeof Query;
aggregate: typeof aggregate;
createUpdater: typeof createUpdater;
find: typeof find;
remove: typeof remove;
update: import("./updater").Updater;
};
export default _default;