On Jul 21, 2010, at 4:59 PM, Talib Sharif wrote:
> Yup, thats what i discovered.
>
> Basically i had
>
> var val = parseInt(doc.field1.attr1)
> emit(doc._id, val)
>
> and doesnt necessaryily mean that it will will be 0 or something.
>
> i had to do
>
> var val = parseInt(doc.field1.attr1)
> if (val)
> emit(doc._id, val)
>
> Thanks,
> Talib
>
Also it is worth noting that equivalent to this reduce function:
function(ks, vs, rr) {
return sum(vs);
}
is the plain text:
_sum
And it will be run in Erlang and be much much faster especially for group
queries.
There is also _count if you would always be emitting the value 1 from your map
and would like to count the # of rows. When you do this you can emit any old
thing, and the value will be ignored, just the # of rows counted.
Chris
>
> On Jul 21, 2010, at 4:37 PM, J Chris Anderson wrote:
>
>>
>> On Jul 21, 2010, at 3:08 PM, Talib Sharif wrote:
>>
>>> I am getting the following error when requesting a view. My Db has about
>>> 100000 documents. And i have about 10 views with either having no reduce
>>> function or a reduce function with 'return sum(values)' as the return value.
>>>
>>> I tried the exact same views on a 2000 documents DB and i don't get this
>>> error. Am i hitting some wall in terms of size? Whats the best way to debug
>>> this?
>>>
>>> {"error":"reduce_overflow_error","reason":"Reduce output must shrink
>>> more rapidly: Current output: '
>>>
>>
>> Are the values scalar numbers before you sum them?
>>
>> You can run log(foo) to log to the couch.log from the view function.
>>
>> Chris
>>
>>>
>>> Thanks,
>>>
>>> Talib
>>
>