reduceContext.values

Property Description

This array holds all values associated with a unique key that was passed to the reduce stage for processing. These values are listed in lexicographical order.

When the map/reduce process includes a map stage, the key-value pairs passed to the reduce stage are derived from the values written by mapContext.write(options).

When the map stage is skipped, the values are determined by the getInputData stage:

  • If the input type is an array, it is the value in the element.

  • If the input type is an object, it is the value in the object.

  • If the input type is a result set, the value is a search.Result object converted to a JSON string with JSON.stringify().

Note:

Each value cannot exceed 1 megabyte.

Type

string[]

Since

2015.2

Syntax

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see Map/Reduce Script Samples.

          ...
function reduce(context)
{
    context.write({
        key: context.key , 
        value: context.values.length 
    }); 
}
... 

        

Related Topics

reduceContext
reduceContext.isRestarted
reduceContext.executionNo
reduceContext.errors
reduceContext.key
reduceContext.write(options)

General Notices