Interface MapReduceOptions<T, K, R>

interface MapReduceOptions<T, K, R> {
    finalize?: ((key, val) => R);
    jsMode?: boolean;
    keeptemp?: boolean;
    limit?: number;
    map: string | Function;
    out?: {
        inline?: number;
        merge?: string;
        reduce?: string;
        replace?: string;
    };
    query?: any;
    readPreference?: string;
    reduce: ((key, vals) => R);
    scope?: any;
    sort?: any;
    verbose?: boolean;
}

Type Parameters

  • T
  • K
  • R

Properties

finalize?: ((key, val) => R)

finalize function

Type declaration

    • (key, val): R
    • Parameters

      • key: K
      • val: R

      Returns R

jsMode?: boolean

it is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X default: false

keeptemp?: boolean

keep temporary data default: false

limit?: number

max number of documents

map: string | Function
out?: {
    inline?: number;
    merge?: string;
    reduce?: string;
    replace?: string;
}

sets the output target for the map reduce job. default: {inline: 1}

Type declaration

  • Optional inline?: number

    the results are returned in an array

  • Optional merge?: string

    {merge: 'collectionName'} add the results to collectionName: if dups exist the new docs overwrite the old

  • Optional reduce?: string

    {reduce: 'collectionName'} add the results to collectionName: if dups are detected, uses the reducer / finalize functions

  • Optional replace?: string

    {replace: 'collectionName'} add the results to collectionName: the results replace the collection

query?: any

query filter object.

readPreference?: string
reduce: ((key, vals) => R)

Type declaration

    • (key, vals): R
    • Parameters

      • key: K
      • vals: T[]

      Returns R

scope?: any

scope variables exposed to map/reduce/finalize during execution

sort?: any

sort input objects using this key

verbose?: boolean

provide statistics on job execution time. default: false