couchDB reduce: does rereduce preserve the order of results from map? -


with couchdb view, results ordered key. have been using values associated highest number. example, take result (in key: value form):

{1:'sam'} {2:'jim'} {4:'joan'} {5:'jill'} 

couchdb sort according key. (it helpful think of key "score".) want find out has highest or lowest score.

i have written reduce function so:

function(keys, values) {  var len = values.length; return values[len - 1];  } 

i know there's _stat , like, these not possible in application (this slimmed down, hypothetical example).

usually when run reduce, either 'sam' or 'jill' depending on whether descending set. want. however, in large data-sets, middle of list.

i suspect happening on rereduce. had assumed when rereduce has been run, order of results preserved. however, can find no assurances case. know on rereduce, key null, normal sorting rules not sorted. case?

if so, advice on how highest scorer?

yeah, don't think sorting order guaranteed, because cannot guaranteed in clustered environments. suspect way you're using map/reduce here little iffy, should post view code if want answer here.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -