mapContext

Object Description

Object that contains:

  • The key-value pairs to process during the map stage.

  • Logic that lets you save data to pass to the reduce stage.

  • Other properties you can use within the map function.

This object includes the following properties and methods:

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 map(context)
{
    for (var i = 0; context.value && i < context.value.length; i++)
        if (context.value[i] !=== ' ' && !PUNCTUATION_REGEXP.test(context.value[i]))
            {
                context.write({
                    key: context.value[i], 
                    value: 1 
                }); 
            }
}
... 

        

Related Topics

map(mapContext)

General Notices