Couchbase views enables the customers to build customized reduce (aggregation) functions that pre-calculates the aggregation and is capable of returning aggregation results very fast.
With the upcoming deprecation of Couchbase Views, Couchbase has no real alternative for this feature since it supports only a pre-defined aggregation function (MAX, MIN, SUM, COUNT, AVG etc.) in N1QL-GSI
A custom aggregation function should be written in JS (as an external function) and/or in N1QL.
For deterministic functions, it would be great to be able to push them down to the indexer.
MongoDB 4.4 added has this feature as described here: https://www.mongodb.com/developer/how-to/use-function-accumulator-operators/
PostgreSQL also has that feature: https://www.postgresql.org/docs/13/sql-createaggregate.html
SQL Server has that feature too (using an external dot net function):