map = function() { emit(this.school_number, this.ticket_number) };

reduce = function(key, value){ return Array.sum(',' + value).slice(1); };

db.tickets.mapReduce(map, reduce, {out: {inline:1}})

db.tickets.mapReduce(map, reduce, {out: {inline:1}, query: {"school_bucket": "1"}})

db.tickets.mapReduce(map, reduce, {out: {inline:1}, query: {"school_number": "2719"}})

db.tickets.mapReduce(map, reduce, “output”)

db.output.find()
10-28 16:58