As with all multi-object retrievals, you'll need to use MapReduce. Make the last phase of your query a "sort" phase. If the result of your map phase is a JSON object that contains the "timestamp" field, the reduce phase might look like this:
function(values){ return values.sort(function(a,b){ return a.timestamp - b.timestamp; }); } If your key includes the timestamp, you could return the whole object from the map phase, and sort by the key instead. This will be even easier if your timestamp is in a reasonable format, e.g. ISO8601, where lexical and numeric sorting are essentially equivalent. The function above assumes you're using a numerical timestamp value, like UNIX epoch time. Sean Cribbs <s...@basho.com> Developer Advocate Basho Technologies, Inc. http://basho.com/ On Dec 11, 2010, at 4:17 PM, Joshua Partogi wrote: > Hi there, > > As I have been told, there is no ordered index in riak. So my question is, > how do you guys implement an ordered index or how do you order a set of data > in riak i.e by timestamps? > > Thanks for sharing. > > -- > http://twitter.com/jpartogi > _______________________________________________ > 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