Created
November 7, 2011 17:57
-
-
Save batasrki/1345669 to your computer and use it in GitHub Desktop.
Map/Reduce inside a Ripple document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def record_ids_containing_category(category) | |
function = <<-eos | |
function(values) { | |
var data = Riak.mapValuesJson(values)[0]; | |
if(data.category === '#{category}') { | |
return [values.key]; | |
} | |
else { | |
return []; | |
} | |
} | |
eos | |
Riak::MapReduce.new(bucket.client).add("transactions").map(function, :keep => true).run | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment