Skip to content

Instantly share code, notes, and snippets.

@james-carr
Created January 13, 2012 20:28
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 james-carr/1608538 to your computer and use it in GitHub Desktop.
Save james-carr/1608538 to your computer and use it in GitHub Desktop.
map = function(){
this.log.forEach(function(logItem){
if(logItem.action == 'Call' && logItem.user != ''){
emit({user: logItem.user, time:logItem.time}, 1);
}
});
};
reduce = function(key, values){
return values;
};
db.leads.mapReduce(map, reduce, {out:'leadCallsReduce'});
@james-carr
Copy link
Author

{
    "result" : "leadCallsReduce",
    "timeMillis" : 1012,
    "counts" : {
        "input" : 5951,
        "emit" : 7804,
        "reduce" : 0,
        "output" : 7804
    },
    "ok" : 1,
}

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