apache / apache/pouchdb

feature request: support couchdb 3.5 builtin reducers _last, _first, _top_N, _bottom_N

Open
#9,105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

CouchDB 3.5 added the following builtin reducers:
https://docs.couchdb.org/en/stable/ddocs/ddocs.html#first
It would be great to have them in pouchdb as well.

Please note that I tried to implement the _last reducer as simply handing back values[values.length-1], which I think is possible since pouchdb does not use rereduce. However, when used together with {descending: true, group: true}, the values seem to be handed into the reducer in reversed order, changing the behaviour of _last to _first. In couchdb, the _last reducer together with {descending: true, group: true} seems to still hand back the last value, only the order of the final view output rows is reversed. So, in pouchdb, the {descending: true} seems to affect the map output, whereas in couchdb it seems to affect the reduce output?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.