/** * Defines generic type with aggregation * operators. * */ export type InAggregation = { /** * At least one of the items should be fulfilled */ $in: Array; }; export type NinAggregation = { /** * Specified field value should not be included in the list */ $nin: Array; }; export type Aggregation = InAggregation | NinAggregation; /** * Defines regex match */ export type RegexMatch = { /** * Item must match regex */ $regex: string; }; /** * Removes the first or the last element from an array * * @example $pop: 1 = removes item from the end of the list * * @example $pop: -1 = removes item from the beginning of the list */ export type Pop = { $pop: PopValue; }; export declare enum PopValue { Start = -1, End = 1 } /** * Base operations for transforming an array */ export type ArrayTransformer = { $slice?: number; $sort?: SortValue; }; /** * Appends specified items to an array. * */ export type Push = { $push: T | PushAggregation; }; export type PushAggregation = ArrayTransformer & { $each: T[]; $position?: number; }; export declare enum SortValue { Asc = 1, Desc = -1 } /** * Appends specified item(s) to an array unless * it's not present already */ export type AddToSet = { $addToSet: T | PushAggregation; }; /** * Removes specified items from an array */ export type Pull = { $pull: T | PullAggregation; }; export type PullAggregation = ArrayTransformer & { $in: T[]; $sort?: SortValue; }; /** * Removes all specified items from an array */ export type PullAll = { $pullAll: T[]; };