Hi James Based on your stackexchange post it looks like the values passed to the reduce function look like [key, data]. This means the sort function would have to access the second element of the array and then access the timestamp.
return b[1]['timestamp'] - a[1]['timestamp']; Let us know if that works for you. Thanks Dan Sent from my iPad On Mar 17, 2012, at 3:09 PM, James Proud <james.pr...@gmail.com> wrote: > function(values) { > > > return values.sort( > function(a, b) { > > > return b['timestamp'] - a['timestamp']; > > > } > ); > } > I'm currently executing the above code for the reduce phase of a Riak > MapReduce query but it is not correctly sorting by the value of timestamp > key. Any ideas why? > > Stackoverflow: > http://stackoverflow.com/questions/9752931/riak-sort-on-map-reduce > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com