couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiril Stankov <ki...@open-net.biz>
Subject Re: Reducing on all emitted docs
Date Thu, 05 Feb 2015 19:21:37 GMT
Just found that... :)
Sorry, a bit more googling next time.
BTW, I use CouchDB for less than a month and I'm in love!
Thanks all!

------------------------------------------------------------------------
*With best regards,*
Kiril Stankov


            This Email disclaimer
            <http://open-net.biz/emailsignature.html> is integral part
            of this message.

On 2/5/2015 9:08 PM, Giovanni P wrote:
> running this with group=true will give you the sum per type, with
> group=false (or without any mention of "group") you'll get the total sum.
>
> On Thu, Feb 5, 2015 at 4:59 PM, Kiril Stankov <kiril@open-net.biz> wrote:
>
>> Hi,
>>
>> I want to get the sum of values from all results, produced by the map
>> function.
>> Something like this:
>>
>> |||  "|map|":|"function(doc) {\n  emit(doc.type, doc.total);\n}"|,
>>   "|reduce|":|"_sum"||||
>>
>>
>> Running this gives me sum per 'doc.type'.
>> I wonder if I can get the sum easily for all 'doc.total' values across all
>> documents, while still keeping the type as key for the map.
>>
>> Thanks in advance!
>> ------------------------------------------------------------------------
>> *With best regards,*
>> Kiril Stankov
>>
>> On 2/4/2015 2:37 AM, Ayhan Kesenci wrote:
>>
>>> I export a view with a curl command
>>>
>>> and the view looks like this in the map
>>>
>>> function(doc) {
>>> emit([doc.user.friends_count,
>>> doc.user.followers_count,doc.retweet_count,doc.text], doc.id_str);
>>> }
>>>
>>>
>>> is it possible to surround the for example doc.user.friends_count with
>>> quote signs, to have it like this with the usual comma between the quote
>>> signs?
>>>
>>>
>>> "doc.user.friends_count","
>>> doc.user.followers_count","doc.retweet_count","doc.text"
>>>
>>> thank you
>>>
>>> 2015-02-04 1:31 GMT+01:00 Ayhan Kesenci <a.kesenci89@googlemail.com>:
>>>
>>>   I export a view with a curl command
>>>> and the view looks like this in the map
>>>>
>>>> function(doc) {
>>>> emit([doc.user.friends_count,
>>>> doc.user.followers_count,doc.retweet_count,doc.text], doc.id_str);
>>>> }
>>>>
>>>>
>>>> is it possible to surround the for example doc.user.friends_count with
>>>> quote signs, to have it like this with the usual comma between the quote
>>>> signs?
>>>>
>>>>
>>>> "doc.user.friends_count","
>>>> doc.user.followers_count","doc.retweet_count","doc.text"
>>>>
>>>>
>>>>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message