export interface IndexedArray extends Array { [index: number]: T; __indexed_buckets?: IndexedBuckets; } export interface IndexedBuckets { [indexedProp: string]: IndexedBucket; } export interface IndexedBucket { __bucket_keys: any; [value: string]: T[]; } export interface Documents extends Array { [index: number]: T; sample?: any[]; } export interface UnwindOptions { path?: String; includeArrayIndex?: String; preserveNullAndEmptyArrays?: boolean; } export interface Meta { index: Number; length: Number; sample: any[]; stop?: boolean; } export type JSPrimatives = RegExp | String | Number | boolean | null; export type MongoDBExpression = { // [field in keyof T as `$${string & field}`]: 1; // $$NOW } export interface MongoDBQuery { [field: string]: JSPrimatives | { $exists: boolean $in: Array; $nin: Array; $ne: JSPrimatives; $eq: JSPrimatives; $equal: JSPrimatives; $lt: JSPrimatives; $lte: JSPrimatives; $gt: JSPrimatives; $gte: JSPrimatives; $or: [MongoDBQuery]; $and: [MongoDBQuery]; $all: [JSPrimatives]; $size: Number; $elemMatch: MongoDBQuery } } export interface MongoDBAccumulator { } export interface Stage { $project?: Omit<{ [field in keyof T]: 1 | true | 0 | false | MongoDBExpression }, "_id"> | { _id: 0 | false }; $match?: MongoDBQuery; $redact?: MongoDBExpression; $limit?: Number; $skip?: Number; $unwind?: { path: String; includeArrayIndex?: String; preserveNullAndEmptyArrays?: boolean; }; $group?: Omit<{ [field in keyof T]: MongoDBAccumulator }, "_id"> | { _id: MongoDBExpression }; $sort?: { [field in keyof T]: 1 | -1 | { $meta: "textScore" | "indexKey" } }; $out?: String | any[]; $sample?: { size: Number }; $lookup?: { from: R; localField: keyof T; foreignField: keyof R; as: String; }; } export type StageKeys = keyof Stage; export interface MongoPipelines { $project?: any; $match?: any; $redact?: any; $limit?: any; $skip?: any; $unwind?: any; $group?: any; $sample?: any; $sort?: any; $lookup?: any; $out?: any; } export declare type MongoReducer = (key?: String, values?: Array) => T; export declare type MongoMapReduceOptions = { sort?: String | any; query?: WhereCondition; limit?: Number; finalize?: MongoFinalize; out?: String | Array; }; export declare type MongoFinalize = (key: string, value: T) => T; export declare type MongoGroupFinalize = (value: T) => T | void; export declare type MongoSet = any; export interface ExtendedArray extends Array { [index: number]: any; items?: Number; } export interface SearchRangeOptions { condition: any; findIndex?: boolean; } export interface CreateFuncOptions { ifblock?: String | boolean; projection?: any; _refs?: any; arr: any[]; limit: Number; condition: any; } export declare type TreeParentFinder = (value?: T) => boolean; export declare type TreeChildFinder = (value?: T) => boolean; export declare type TreeOptions = { childProperty?: String; }; export declare type WhereCondition = any; export declare type DeleteOptions = { justOne: boolean; }; export declare type GroupOptions = { key?: any; field?: any; condition?: String | any; cond?: String | any; reduce?: (current: any, accumulator: any) => void; initial?: any; keyf?: Array | ((doc: any) => Array); finalize?: MongoGroupFinalize; }; export declare type ArrayIterator = (obj: T, index?: Number | T, objs?: Array) => any; export interface Fields { [key: string]: boolean | 0 | 1; }