summaryContext.output

Property Description

Iterator that provides keys and values that are saved as output during the reduce stage.

Note that keys are listed in lexicographical order.

Type

iterator

Since

2015.2

Members

Member

Type

Required/Optional

Description

iterator().each(parameters)

function

required

Executes one time for each key-value pair.

parameters

Member

Type

Required/Optional

Description

iteratorFunction(key, value).

See functionParameters.

function

required

Provides logic to be executed during each iteration.

functionParameters

Parameter

Type

Required/Optional

Description

key

string

optional

The key saved at the end of the reduce stage by using the reduceContext.write(options) method.

value

string

optional

The value saved at the end of the reduce stage by using the reduceContext.write(options) method.

Syntax

          // Add additional code
...

// Create a variable to track how many key-value pairs were written.
var totalRecordsUpdated = 0;


// If the number of key-value pairs is expected to be manageable, log 
// each one.

summary.output.iterator().each(function (key, value){
    log.audit({
        title: ' summary.output.iterator', 
        details: 'key: ' + key + ' / value: ' + value
    });
    totalRecordsUpdated++;
    return true;
 });

// Create a log entry showing the number of              

log.debug({
    title: 'Total records updated',
    details: totalRecordsUpdated
});
...
// Add additional code. 

        

Related Topics

General Notices