What is the CouchDB equivalent of the SQL COUNT(*) aggregate function? -
Yes, I am a social jockey who is coming to the CouchDee Map / reducing the world. I thought I thought how (*) equal to SOG aggregator for COBDB datasets with the following:
map:
function (doc) {emit (doctor Name, doctor); }
decrease:
function (keys, values, radius) {return values.length; }
I thought I worked, like returning something:
"super fun c" 2 "super fun d" 2 "super fun e" 2 "Super Fun F" 18
... but not really, when I add a record, this count changes in depth. Sometimes the count actually decreases , which was very surprising. Am I doing something wrong? Maybe I can not fully understand the concept of final compatibility?
It seems that reducing your results is possible again. That is, decrease
is called more than once for each key and then again called with those results, you handle it with the short
function like this Can:
function (keys, value, iterative) {if (iterative) {return amount (value); } And {return values. Length; Alternatively, you can change the map
function so that the value is always counted by the documents: / / Map function (doctor) {emit (doc.name, 1); } // reduce the function (keys, value, iterative) {return amount (value); }
Comments
Post a Comment