mingo
Version:
MongoDB query language for in-memory objects
29 lines (28 loc) • 1.46 kB
TypeScript
import { Iterator } from "../../lazy";
import type { Any, AnyObject, Options } from "../../types";
interface InputExpr {
/** Collection for the $graphLookup operation to search. */
from: string | AnyObject[];
/** Expression that specifies the value of the connectFromField with which to start the recursive search. */
startWith: Any;
/** Field name whose value $graphLookup uses to recursively match against the connectToField. */
connectFromField: string;
/** Field name in other documents against which to match the value of the field. */
connectToField: string;
/** Name of the array field added to each output document. */
as: string;
/** Non-negative integral number specifying the maximum recursion depth. */
maxDepth?: number;
/** Name of the field to add to each traversed document in the search path. */
depthField?: string;
/** A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. */
restrictSearchWithMatch?: AnyObject;
}
/**
* Performs a recursive search on a collection.
* To each output document, adds a new array field that contains the traversal results of the recursive search for that document.
*
* See {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/ usage}.
*/
export declare function $graphLookup(coll: Iterator, expr: InputExpr, options: Options): Iterator;
export {};