Skip to content

Instantly share code, notes, and snippets.

@RedBeard0531
Created February 13, 2010 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedBeard0531/303202 to your computer and use it in GitHub Desktop.
Save RedBeard0531/303202 to your computer and use it in GitHub Desktop.
db.events.mapReduce(
function(){
emit({category:this.category, uid:this.uid}, null);
},
function(key, values){
return null;
},
{query: {type: "pageview"}}
).map_reduce(
function(){
emit(this._id.category, 1);
},
function(key, values){
return Array.sum(values);
},
{out:'unique_by_category'}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment