Skip to content

Instantly share code, notes, and snippets.

@umit
Created May 13, 2012 12:24
Show Gist options
  • Save umit/2688181 to your computer and use it in GitHub Desktop.
Save umit/2688181 to your computer and use it in GitHub Desktop.
map = function map() {
emit(this.type, {productColor :[this.color]});
}
reduce = function reduce(key, values) {
var colors = [];
var results = { colors:[] };
values.forEach(function(value){
value.productColor.forEach(function(colorValue){
colors.push(colorValue);
});
});
results.colors = colors;
return results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment