Input

The following table describes the fields in the Input tab of the MapReduce activity.

Input Item Data Type Description
CollectionName String Enter the name for the collection, where map-reduce operations are performed, with single or double quotation marks.
Note: The value specified in this field overwrites the value specified in the Collection Name field in the General tab.
JavaScriptMapFunction JavaScript Enter a JavaScript with double quotation marks to map an operation in every document in a collection. The operation emits key and value pairs.
Note: The value specified in this field overwrites the value specified in the Map Function field in the General tab.
JavaScriptReduceFunction JavaScript Enter a JavaScript with double quotation marks to reduce all values of a specific key to one element which contains the result.
Note: The value specified in this field overwrites the value specified in the Reduce Function field in the General tab.
JavaScriptFinalizeFunction JavaScript Enter a JavaScript with double quotation marks to modify the output result.
Note: The value specified in this field overwrites the value specified in the Finalize Function field in the General tab.
OutputTarget String Enter a collection name with double quotation marks to store a map-reduce operation result.
Note: If the output type is inline, leave this field blank.
OutputType String Select one output type from the following lists:
  • INLINE

    Returns the result inline.

  • REPLACE

    Replaces the contents of the specified collection, if the specified collection exists .

  • MERGE

    Merges the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, the new result overwrites that existing document.

  • REDUCE

    Merges the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, the reduce function is applied to both, the new and the existing documents, and the existing document is overwritten by the result.

QueryDocument String Enter a document with double quotation marks. This document is used to query documents to be mapped and reduced.
Limit String Enter a number to decide how many documents to keep after the query document operation.
SortDocument String Enter a document with double quotation marks. This document is used to define the display order of documents after the limit operation.