Turned "group" mongodb statment into "aggregate" that is dramatically faster, but mongodb 2.1+ must be used.