Skip to content

Instantly share code, notes, and snippets.

@frank06
Created September 30, 2010 18:28
Show Gist options
  • Save frank06/605060 to your computer and use it in GitHub Desktop.
Save frank06/605060 to your computer and use it in GitHub Desktop.
db = require('riak-js').getClient()
db
.add([['catalogs', 'politics']])
.link({ bucket: 'books', keep: false })
.map(function(value) {
// ejsLog('/tmp/mapreduce', JSON.stringify(value));
value = Riak.mapValuesJson(value)[0];
return [
{
id: value.id,
title: value.title,
author: value.author
}
];
})
.reduce(function(values) {
return values.sort(function(a, b) { return a.title < b.title ? -1 : 1; });
})
.run()
@alejamp
Copy link

alejamp commented Oct 25, 2011

Thank you Frank, It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment