Skip to content Skip to sidebar Skip to footer

What Javascript Functions Are Available In The Couchdb Map And Reduce View Functions?

When writing map and reduce view functions for CouchDB in JavaScript, what are the build-in functions available? For example, various examples refer to the following 2 functions: e

Solution 1:

I don't know the CouchDB internals, however, from reading the sources, it looks like the map functions are evaluated in the sandbox created by init_sandbox(). So the available "global" functions are the ones you see added to it. For example:

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

Solution 2:

Well first: not CacheDB but CouchDB (header). Second: these are not built-in Javascript functions - these are just built-in functions which work in Erlang. As far as i know there are only _sum and _count functions available.

Post a Comment for "What Javascript Functions Are Available In The Couchdb Map And Reduce View Functions?"