Hey,
we recently changed things here. main.js is now generated
from a set of source files, just to keep things a little more
manageable. The definition of the sum() function now lives
in views.js. If you run `make` or `make install`, the contents
of view.js and the other files are copied into main.js. If you
change things in main.js, your changes will get lost the next
time you install CouchDB.
I agree that it is preferable to setup something more maintainable
in the long run, but the existing solution is good enough to
focus on other areas of work. :)
Cheers
Jan
--
On 22 Apr 2009, at 07:00, Thomas Heller wrote:
Hey,
you can find it in COUCH_HOME/share/server/main.js
sum = function(values) {
var rv = 0;
for (var i in values) {
rv += values[i];
}
return rv;
}
And no, its the only "helper" function.
Regards,
/thomas
On Wed, Apr 22, 2009 at 3:55 PM, Rangachari Anand
<[email protected]> wrote:
I searched all over the wiki and did not see any description of the
sum function that can be called in the reduce method of
a view. I can guess what it does but a pointer to more
concrete information would be appreciated.
There is only a passing reference to it in the page
http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views
Are there any other handy functions that could be called from inside
map or reduce?
Thanks
Rangachari Anand