Custom reduce functions

Why do we need custom reduce functions? Sometimes, the built-in reduce function doesn't meet our requirements, although it will suffice most of the time.

Custom reduce functions allow you to create your own reduce function. In such a reduce function, output of map function goes to the corresponding reduce function group as per the key of the map output and the group level parameter. Couchbase ensures that output from the map will be grouped by key and supplied to reduce. Then it's developer's role to define logic in reduce, what to perform on the data such as aggregating, addition etc.

To handle the incremental MapReduce functionality (that is, updating an existing view), each function must also be able to handle and consume ...

Get Learning Couchbase now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.