src/main/java/io/maggregator/Aggregator.java
public <T> T execute(Function<AggregateIterable<Document>, T> transformation) {

        validate(transformation);

        MongoCollection collection = mongoDatabase.getCollection(this.collection);

        List<Bson> pipeline = Arrays.asList(match(filter), projection, groupBy);

        final AggregateIterable aggregate = collection.aggregate(pipeline);

        return (T) transformation.apply(aggregate);
    }
/**
     * Applies the aggregation to the collection and uses {@code transformation} to get the
     * information in a usable format.
     *
     * @param transformation The function that transform the result of the aggregation process to
     *                       a usable format
     * @param <T> Return type
     * @return The transformed result of the aggregation process
     * @throws IllegalArgumentException If the collection or the filters or the projection fields
     *                                  or the group by clause or the transformation are not present
     */
Applies the aggregation to the collection and uses  transformation to get the
information in a usable format.

@param transformation The function that transform the result of the aggregation process to
a usable format
@param  Return type
@return The transformed result of the aggregation process
@throws IllegalArgumentException If the collection or the filters or the projection fields
or the group by clause or the transformation are not present
Applies the aggregation to the collection and uses transformation to get the information in a usable format . @param transformation The function that transform the result of the aggregation process to a usable format @param Return type @return The transformed result of the aggregation process @throws IllegalArgumentException If the collection or the filters or the projection fields or the group by clause or the transformation are not present
public <T> T execute(Function<AggregateIterable<Document>, T> transformation) {
        validate(transformation);
        MongoCollection collection = mongoDatabase.getCollection(this.collection);
        List<Bson> pipeline = Arrays.asList(match(filter), projection, groupBy);
        final AggregateIterable aggregate = collection.aggregate(pipeline);
        return (T) transformation.apply(aggregate);
    }
public < T > T execute ( Function < AggregateIterable < Document > , T > transformation ) { validate ( transformation ) ; MongoCollection collection = mongoDatabase . getCollection ( this . collection ) ; List < Bson > pipeline = Arrays . asList ( match ( filter ) , projection , groupBy ) ; final AggregateIterable aggregate = collection . aggregate ( pipeline ) ; return ( T ) transformation . apply ( aggregate ) ; }
Applies the aggregation to the collection and uses {@code transformation} to get the
 information in a usable format.
Applies the aggregation to the collection and uses { @code transformation } to get the information in a usable format .