incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hhsuper <hhsu...@gmail.com>
Subject Re: 'Grouping' documents so that a set of documents is passed to the view function
Date Tue, 23 Jun 2009 01:15:46 GMT
Hi Brian I know your mean, even though, we can still with reduce function
which need us impl rereduce correctly process with these grouped documents
and get right result, is that right brian?

On Tue, Jun 23, 2009 at 3:05 AM, Brian Candler <B.Candler@pobox.com> wrote:

> On Mon, Jun 22, 2009 at 09:49:15PM +0800, hhsuper wrote:
> > Brian's decription for reduce function is clearly, but i think you can
> > achieve your goal as below:
> >
> > function(doc){
> >   emit(doc.group_key, doc)
> > }
> >
> > function(keys,values,rereduce){
> >   //...
> > }
> >
> > with the group=true option you can impl doc process by group_key in
> reduce
> > function,
> > as your example reduce will be invoke two times with values:
> > [firstdoc,seconddoc] which groupkey=1.... [thirddoc,forthdoc]
>  groupkey=2,
>
> No, what I'm saying is it will *not necessarily* be invoked that way. If
> there are only a handful of documents with the same group key then it is
> quite likely to be invoked that way. However if there are dozens or
> hundreds
> of documents with the same group key, it could be invoked like this:
>
>  reduce(first bunch of documents)    => R1
>  reduce(second bunch of documents)   => R2
>  rereduce(R1,R2)
>



-- 
Yours sincerely

Jack Su

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