org.springframework.data.mongodb.core.aggregation

Class AggregationResults<T>

  • java.lang.Object
    • org.springframework.data.mongodb.core.aggregation.AggregationResults<T>
  • Type Parameters:
    T - The class in which the results are mapped onto.
    All Implemented Interfaces:
    Iterable<T>


    public class AggregationResults<T>
    extends Object
    implements Iterable<T>
    Collects the results of executing an aggregation operation.
    Since:
    1.3
    Author:
    Tobias Trelle, Oliver Gierke, Thomas Darimont, Christoph Strobl, Mark Paluch
    • Constructor Detail

      • AggregationResults

        public AggregationResults(List<T> mappedResults,
                                  org.bson.Document rawResults)
        Creates a new AggregationResults instance from the given mapped and raw results.
        Parameters:
        mappedResults - must not be null.
        rawResults - must not be null.
    • Method Detail

      • getMappedResults

        public List<T> getMappedResults()
        Returns the aggregation results.
        Returns:
      • getUniqueMappedResult

        @Nullable
        public T getUniqueMappedResult()
        Returns the unique mapped result. Assumes no result or exactly one.
        Returns:
        Throws:
        IllegalArgumentException - in case more than one result is available.
      • getServerUsed

        @Nullable
        public String getServerUsed()
        Returns the server that has been used to perform the aggregation.
        Returns:
      • getRawResults

        public org.bson.Document getRawResults()
        Returns the raw result that was returned by the server.
        Returns:
        Since:
        1.6