UNPKG

mongodb-aggregate-builder

Version:
160 lines (159 loc) 4.36 kB
import { DensifyInterface, IntoType, OnType, WhenMatchedType, WhenNotMatchedType, SortExpression, BasicKeyValueInterface, UnitType, GeoNear } from './types'; import { FacetInterface } from '@/types/facet'; import { FillInterface } from '@/types/fill'; export declare class AggregateBuilder { private aggregate; /** * @param groupBy * @param boundaries * @param defaultValue * @param output */ bucket(groupBy: string, boundaries: number[], defaultValue: string, output: any): this; /** * @param groupBy * @param buckets * @param output * @param granularity */ bucketAuto(groupBy: string, buckets: number, output?: any, granularity?: string): this; /** * @param allChangesForCluster * @param fullDocument * @param fullDocumentBeforeChange * @param resumeAfter * @param showExpandedEvents * @param startAfter * @param startAtOperationTime */ changeStream(allChangesForCluster: boolean, fullDocument: string, fullDocumentBeforeChange: string, resumeAfter: number, showExpandedEvents: boolean, startAfter: any, startAtOperationTime: any): this; /** * @param documentsExpression */ documents(documentsExpression: any[]): this; /** * @param facet */ facet(facet: FacetInterface): this; /** * @param densifyData */ densify(densifyData: DensifyInterface): this; /** * @param fillData */ fill(fillData: FillInterface): this; /** * @param geoExpression */ geoNear(geoExpression: GeoNear): this; /** * @param from * @param startWith * @param connectFromField * @param connectToField * @param as * @param maxDepth * @param depthField * @param restrictSearchWithMatch */ graphLookup(from: string, startWith: any, connectFromField: string, connectToField: string, as: string, maxDepth?: number, depthField?: string, restrictSearchWithMatch?: {}): this; /** * @param from * @param localField * @param foreignField * @param as * @param pipeline */ lookup(from: string, localField: string, foreignField: string, as: string, pipeline?: any[]): this; /** * @param into * @param on * @param letVariables * @param whenMatched * @param whenNotMatched */ merge(into: IntoType, on?: OnType, letVariables?: any, whenMatched?: WhenMatchedType, whenNotMatched?: WhenNotMatchedType): this; /** * @param db * @param collection */ out(db: string, collection: string): this; /** * @param size */ sample(size: number): this; /** * @param output * @param partitionBy * @param sortBy * @param window * @param documents * @param range * @param unit */ setWindowFields(output: any, partitionBy?: string, sortBy?: any, window?: any, documents?: any, range?: any, unit?: UnitType | null): this; unionWith(coll: string, pipeline: any[]): this; unwind(path: string, preserveNullAndEmptyArrays?: boolean): this; /** * @param fields */ unset(fields: string[]): this; project(fields: any): this; addFields(fields: BasicKeyValueInterface): this; /** * * @param newRoot */ replaceRoot(newRoot: any): this; /** * @param newRoot */ replaceWith(newRoot: any): this; /** * @param query */ match(query: any): this; /** * @param fields */ group(fields: any): this; /** * @param fields */ set(fields: any): this; /** * @param skipValue */ skip(skipValue: number): this; /** * @param limit */ limit(limit: number): this; /** * @param expression */ sortByCount(expression: any): this; /** * @param sort */ sort(sort: SortExpression): this; /** * @param countName */ count(countName: string): this; /** * Merge several part of aggregation in one * @param aggregate */ mergeAggregation(aggregate: any[]): any[]; /** * Merge several part of aggregation in one with current state * @param aggregate */ mergeAggregationWithCurrent(aggregate: any[]): this; /** * Return prepared aggregate */ build(): any[]; }