mingo
Version:
MongoDB query language for in-memory objects
27 lines (26 loc) • 1.21 kB
TypeScript
import { Iterator } from "../../lazy";
import type { AnyObject, Options } from "../../types";
interface InputExpr {
/** The output collection. */
readonly into: string | AnyObject[];
/** Field or fields that act as a unique identifier for a document. */
readonly on?: string | string[];
/** Specifies variables for use in the whenMatched pipeline. */
readonly let?: AnyObject;
/**
* The behavior of $merge if a result document and an existing document
* in the collection have the same value for the specified on field(s).
*/
readonly whenMatched?: "replace" | "keepExisting" | "merge" | "fail" | AnyObject[];
/** The behavior of $merge if a result document does not match an existing document in the out collection. */
readonly whenNotMatched?: "insert" | "discard" | "fail";
}
/**
* Writes the resulting documents of the aggregation pipeline to a collection.
*
* NB: Object are deep cloned for outputing regardless of the ProcessingMode.
*
* See {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/ usage}.
*/
export declare function $merge(coll: Iterator, expr: InputExpr, options: Options): Iterator;
export {};