Skip to content

Instantly share code, notes, and snippets.

@imsickofmaps
Created October 9, 2012 16:01
Show Gist options
  • Save imsickofmaps/3859733 to your computer and use it in GitHub Desktop.
Save imsickofmaps/3859733 to your computer and use it in GitHub Desktop.
riak mapreduce problems
query = riakclient.add('products')
query.map("""
function(v, arg) {
var data = JSON.parse(v.values[0].data);
if(data.category == arg.category) {
return [[v.key, arg.category]];
} else {
return [];
}
}""", {"category":"food"})
for result in query.run():
print result
[u'772216be03d211e2b7ae080027feaaaf', None]
[u'e90186a803d111e2b7ae080027feaaaf', None]
[u'ac8ddb0003d011e2b7ae080027feaaaf', None]
[u'132d425603d111e2b7ae080027feaaaf', None]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment