updating mongo mapreduce logic