incremental map reduce function for mongodb