implemented a group by in MongoDb DAO.