couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Van Couvering <david.vancouver...@gmail.com>
Subject Re: Reducing to unique values...
Date Fri, 27 Feb 2009 22:22:36 GMT
I would hesitate uniquing on the client side as you are as a result shipping
more data across the network.  I don't fully grok your other solution, but
in general I would try to reduce the output as much as possible when
building the view and then ship just what you need over to the client.

David

On Fri, Feb 27, 2009 at 2:13 PM, kowsik <kowsik@gmail.com> wrote:

> First time I'm playing with rereduce and stumped a bit. I got emits like
> this:
>
>    ("a", "one")
>    ("a", "two")
>    ("a", "one")
>    ("a", "one")
>    ("b", "three")
>    ("b", "three")
>
> What I would like to get at the end of the reduce is this:
>
>    { key: "a", value: [ "one", "two" ] }
>    { key: "b", value: [ "three" ] }
>
> I could implement a really simple reduce like this:
>
>    reduce(k, v) { return v }
>
> and then unique on the client side.
>
> Other option is to emit(["a", "one"], 1), reduce to sum and then use
> startkey/endkey to walk through the unique keys.
>
> Is there a better way?
>
> Thanks,
>
> K.
>



-- 
David W. Van Couvering

I am looking for a senior position working on server-side Java systems.
 Feel free to contact me if you know of any opportunities.

http://www.linkedin.com/in/davidvc
http://davidvancouvering.blogspot.com
http://twitter.com/dcouvering

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