incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wout Mertens <>
Subject Re: [user] Obtaining unique values from a view
Date Tue, 03 Mar 2009 14:52:25 GMT
On Mar 3, 2009, at 3:29 PM, Jan Lehnardt wrote:

> On 3 Mar 2009, at 15:08, Wout Mertens wrote:
>> On Mar 3, 2009, at 2:58 PM, Manolo Padron Martinez wrote:
>>>> I believe this has been covered in this thread:
>>>> but I think a totally satisfactory answer was not found.
>>> Thanks that works for me.
>> Actually now I'm curious where the sum() function comes from. I  
>> can't find it in any Javascript references. Is it something Couch  
>> provides?
>> Answer: grepping through the source showed me it's in main.js.
>> Since this question has been posed more than once, maybe main.js  
>> should have a uniq() function as well?
> Patches welcome :) Feel free to submit uniq() to JIRA:

Actually it's slightly more difficult than I thought since the most  
efficient way to implement it is by guaranteeing that input is sorted.

Here's a nice implementation:

so maybe the uniq() function should take the re-reduce parameter and  
if that's not set, sort the input?

Would that be acceptible for a function in main.js?


View raw message