Skip to content

Instantly share code, notes, and snippets.

@ppillip
Created March 9, 2013 23:13
Show Gist options
  • Save ppillip/5126215 to your computer and use it in GitHub Desktop.
Save ppillip/5126215 to your computer and use it in GitHub Desktop.
// RDB - select birth , working , count(*) from users group by birth , working
// mongoDB map reduce
db.users.group({
key:{birth:1,working:1},
reduce:function(obj,prev){
if(!obj.hasOwnProperty("key")){
prev.birth = obj.birth;
prev.working = obj.working;
}
},
initial:{}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment