mapContext.key

Property Description

The key to be processed during the map stage.

  • If the input type is an array, the key is the index of the element.

  • If the input type is an object, the key is the key in the object.

  • If the input type is a result set, the key is the internal ID of the result. If the search result has no internal ID, the key is the index of the search result.

Note:

Each key cannot exceed 4000 bytes.

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.

          // Add additional code 
...
     
    context.write({
        key: context.value[i], 
        value: 1 
    }); 
 ...
// Add additional code 

        

Related Topics

mapContext
mapContext.isRestarted
mapContext.executionNo
mapContext.errors
mapContext.value
mapContext.write(options)

General Notices