You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ayhan Kesenci <a....@googlemail.com> on 2015/02/09 16:22:11 UTC

Reduce function in couchdb

I would like to reduce a view to get the sum of some ids I have this view

function(doc) {

emit([doc.retweeted_status.user.id.toString(),doc.retweeted_status.user.lang.toString(),doc.retweeted_status.id.toString()]);
}



and would reduce to get the sum of doc_retweeted_status.id.toString()


and try this to reduce, to get the value how many times a id exist in my
couchdb

Is it possible to use it like I imagine ?

thank you guys

Re: Reduce function in couchdb

Posted by Ayhan Kesenci <a....@googlemail.com>.
Looks fine in the view, but cant export it with the curl command :(

2015-02-10 23:48 GMT+01:00 Alexander Shorin <kx...@gmail.com>:

> Use builtin reduce function _count:
>
> http://docs.couchdb.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
> --
> ,,,^..^,,,
>
>
> On Mon, Feb 9, 2015 at 6:22 PM, Ayhan Kesenci
> <a....@googlemail.com> wrote:
> > I would like to reduce a view to get the sum of some ids I have this view
> >
> > function(doc) {
> >
> >
> emit([doc.retweeted_status.user.id.toString(),doc.retweeted_status.user.lang.toString(),doc.retweeted_status.id.toString()]);
> > }
> >
> >
> >
> > and would reduce to get the sum of doc_retweeted_status.id.toString()
> >
> >
> > and try this to reduce, to get the value how many times a id exist in my
> > couchdb
> >
> > Is it possible to use it like I imagine ?
> >
> > thank you guys
>

Re: Reduce function in couchdb

Posted by Alexander Shorin <kx...@gmail.com>.
Use builtin reduce function _count:
http://docs.couchdb.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
--
,,,^..^,,,


On Mon, Feb 9, 2015 at 6:22 PM, Ayhan Kesenci
<a....@googlemail.com> wrote:
> I would like to reduce a view to get the sum of some ids I have this view
>
> function(doc) {
>
> emit([doc.retweeted_status.user.id.toString(),doc.retweeted_status.user.lang.toString(),doc.retweeted_status.id.toString()]);
> }
>
>
>
> and would reduce to get the sum of doc_retweeted_status.id.toString()
>
>
> and try this to reduce, to get the value how many times a id exist in my
> couchdb
>
> Is it possible to use it like I imagine ?
>
> thank you guys