Skip to content

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

@rednil

Description

@rednil

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions