couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svilen ...@svilendobrev.com>
Subject Re: what's the order of docs/keys going into reduce func?
Date Sat, 22 Sep 2012 22:07:10 GMT
> > here's something about it
> > http://osdir.com/ml/couchdb-user/2009-05/msg00149.html
> 
> I can't access it :(
search for title "Ordering of keys into reduce function", maybe look in
google's cache.

> > function( keys, values, rereduce) {
> >   var mx = 0, vmx = null;
> >   for (var k in values) {
> >     var v = values[k];
> >     if (v.seq > mx) { mx= v.seq; vmx = v; }
> >   }
> >   return vmx;
> > }
> > and since it's not relying on seq order anymore, map func can
> > just emit( doc.name, doc).
> 
> Emitting (doc.name, doc.seq) would be enough here.
> Unless you know what you do, you shouldn't emit a full doc; it's a
> waste of space since it is always available when you query with
> &include_docs=true

yeah but that works for non-reduce views only:

couchdb.http.ServerError: (400, ('query_parse_error', 'Query parameter
`include_docs` is invalid for reduce views.'))

svil

Mime
View raw message