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>
Collects the results of executing an aggregation operation.
- Since:
- 1.3
- Author:
- Tobias Trelle, Oliver Gierke, Thomas Darimont, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorDescriptionAggregationResults
(List<T> mappedResults, org.bson.Document rawResults) Creates a newAggregationResults
instance from the given mapped and raw results. -
Method Summary
Modifier and TypeMethodDescriptionReturns the aggregation results.org.bson.Document
Returns the raw result that was returned by the server.Returns the server that has been used to perform the aggregation.Returns the unique mapped result.iterator()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AggregationResults
Creates a newAggregationResults
instance from the given mapped and raw results.- Parameters:
mappedResults
- must not be null.rawResults
- must not be null.
-
-
Method Details
-
getMappedResults
Returns the aggregation results.- Returns:
- the list of already mapped results or an empty one if none found.
-
getUniqueMappedResult
Returns the unique mapped result. Assumes no result or exactly one.- Returns:
- the single already mapped result object or raise an error if more than one found.
- Throws:
IllegalArgumentException
- in case more than one result is available.
-
iterator
-
getServerUsed
Returns the server that has been used to perform the aggregation.- Returns:
- can be null.
-
getRawResults
public org.bson.Document getRawResults()Returns the raw result that was returned by the server.- Returns:
- the raw response.
- Since:
- 1.6
-