mathieulaporte
4/28/2014 - 8:35 PM

mapreduce.js

map = function() {
  emit(this.gender, 1);
};

reduce = function(key, values) {
  return Array.sum(values);
};

db.characters.mapReduce(map, reduce, {
    out: "gender_count"
});