import type { ObjectId } from '../bson'; import { Document } from '../bson'; import type { Collection } from '../collection'; import type { Server } from '../sdam/server'; import type { ClientSession } from '../sessions'; import type { Sort } from '../sort'; import { Callback } from '../utils'; import { CommandOperation, CommandOperationOptions } from './command'; /** @public */ export declare type MapFunction = (this: TSchema) => void; /** @public */ export declare type ReduceFunction = (key: TKey, values: TValue[]) => TValue; /** @public */ export declare type FinalizeFunction = (key: TKey, reducedValue: TValue) => TValue; /** @public */ export interface MapReduceOptions extends CommandOperationOptions { /** Sets the output target for the map reduce job. */ out?: 'inline' | { inline: 1; } | { replace: string; } | { merge: string; } | { reduce: string; }; /** Query filter object. */ query?: Document; /** Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. */ sort?: Sort; /** Number of objects to return from collection. */ limit?: number; /** Keep temporary data. */ keeptemp?: boolean; /** Finalize function. */ finalize?: FinalizeFunction | string; /** Can pass in variables that can be access from map/reduce/finalize. */ scope?: Document; /** It is possible to make the execution stay in JS. Provided in MongoDB \> 2.0.X. */ jsMode?: boolean; /** Provide statistics on job execution time. */ verbose?: boolean; /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ bypassDocumentValidation?: boolean; } /** * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection. * @internal */ export declare class MapReduceOperation extends CommandOperation { options: MapReduceOptions; collection: Collection; /** The mapping function. */ map: MapFunction | string; /** The reduce function. */ reduce: ReduceFunction | string; /** * Constructs a MapReduce operation. * * @param collection - Collection instance. * @param map - The mapping function. * @param reduce - The reduce function. * @param options - Optional settings. See Collection.prototype.mapReduce for a list of options. */ constructor(collection: Collection, map: MapFunction | string, reduce: ReduceFunction | string, options?: MapReduceOptions); execute(server: Server, session: ClientSession | undefined, callback: Callback): void; } //# sourceMappingURL=map_reduce.d.ts.map