incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Stott <nrst...@gmail.com>
Subject Re: Counting unique items
Date Sat, 21 Nov 2009 22:58:59 GMT
You can pass reduce=false to turn off the reduce step of views with reduces
if that helps

On Sat, Nov 21, 2009 at 3:09 PM, Guy Moulton <guy.d.moulton@gmail.com>wrote:

> Hello,
>
> I'm trying to get a count of the number of unique items in a database.
>  Documents look like this:
>
> Item: Item_A, User: Dave
> Item: Item_A, User: John
> Item: Item_A, User: Jane
> Item: Item_B, User: John
> Item: Item_B, User: Anne
>
> In the above example, I'd like to know that there are 2 items.  So
> far, I have a map/reduce that produces one view row for each kind of
> item (similar to the example on the wiki) :
>
> key: "Item_A", value:"Null"
> key: "Item_B", value:"Null"
>
> So the number I need is the number of rows in the view.
>
> According to the wiki, if I pass limit=0, it should give me the
> meta-data, but this doesn't seem to work on views that have a reduce
> function.  I don't want to count rows in the client as there could
> potentially be a very large number.
>
> Any ideas would be very much appreciated.
>
> Regards,
> Guy
>

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