What JavaScript functions are available on the CouchDB map and reduce the viewing functions?

When writing a map and reducing view functions for CouchDB in JavaScript, what are the built-in functions available?

For example, various examples relate to the following two functions: emit(key, value) and sum(values) . Are there other functions like avg(values) ?

Where can I find a complete list of all available features?

+4
source share
2 answers

I don’t know the internal elements of CouchDB, however, from reading the sources, it looks like the map functions are evaluated in the init_sandbox() sandbox created. Thus, the available "global" functions are those that you see added to them. For instance:

_sum and _count instead have built-in shrinking functions written in Erlang, and you can use them only as-is.

+2
source

Good first: not CacheDB, but CouchDB (header). Secondly: these are not Javascript built-in functions - they are just built-in functions that work in Erlang. As far as I know, only _sum and _count functions are available.

0
source

Source: https://habr.com/ru/post/1380527/


All Articles