Skip to content

Instantly share code, notes, and snippets.

@josefsalyer
Created August 25, 2010 20:24
Show Gist options
  • Save josefsalyer/550220 to your computer and use it in GitHub Desktop.
Save josefsalyer/550220 to your computer and use it in GitHub Desktop.
m = function () {
var events = [this._id];
this.tags.forEach( function (z) {
emit( z, {count:1, events: events} );
});
}
r = function (key, values) {
var total = 0;
events = [];
for (var i = 0; i < values.length; i++) {
total += values[i].count;
events.join(events, values[i].events);
}
return {count:total, events:events};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment