code: public static MongoDBCommand forProjection(Projection projection, DBObject query) {
  
          String field = projection.getField();
  
          switch ((ProjectionType) projection.getDetails()) {
              case Average:
                  return new AverageMapReduceCommand(query, field);
              case Count:
                  return new CountCommand(query, field);
              case CountDistinct:
                  return new CountDistinctMapReduceCommand(query, field);
              case Maximum:
                  return new MaximumMapReduceCommand(query, field);
              case Minimum:
                  return new MinimumMapReduceCommand(query, field);
              case RowCount:
                  return new RowCountCommand(query);
              case Sum:
                  return new SumMapReduceCommand(query, field);
              default:
                  throw new UnsupportedOperationException(projection.getDetails() + " not supported.");
          }
      }
docs: -------------------------------------------------------------