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?