Skip to content

Instantly share code, notes, and snippets.

@csanz
Created August 31, 2012 04:15
Show Gist options
  • Save csanz/3549007 to your computer and use it in GitHub Desktop.
Save csanz/3549007 to your computer and use it in GitHub Desktop.
Get all members from all communities mapreduce
map = function() { emit('stats.users', 1) }
red = function(k, vals) {
var i, sum = 0
for (i in vals) {
sum += vals[i]
}
return sum
}
res = db.communities.mapReduce(map, red, {out: "colOut"})
db[res.result].find()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment