incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Rakotojaona <matthieu.rakotoja...@gmail.com>
Subject Re: what's the order of docs/keys going into reduce func?
Date Sat, 22 Sep 2012 21:52:19 GMT
On Sat, Sep 22, 2012 at 11:18 PM, svilen <az@svilendobrev.com> wrote:
> well yeah seems one can't rely on key ordering.
> here's something about it
> http://osdir.com/ml/couchdb-user/2009-05/msg00149.html

I can't access it :(

> 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

-- 
Matthieu RAKOTOJAONA

Mime
View raw message