Fix mapreduce script to keep withing BSON length requirements