Created
August 31, 2012 04:15
-
-
Save csanz/3549007 to your computer and use it in GitHub Desktop.
Get all members from all communities mapreduce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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