public interface AggregationPipeline
| Modifier and Type | Method and Description |
|---|---|
<U> Iterator<U> |
aggregate(Class<U> target)
Executes the pipeline and aggregates the output in to the type mapped by the target type using the default options as defined in
AggregationOptions. |
<U> Iterator<U> |
aggregate(Class<U> target,
AggregationOptions options)
Executes the pipeline and aggregates the output in to the type mapped by the target type.
|
<U> Iterator<U> |
aggregate(Class<U> target,
AggregationOptions options,
ReadPreference readPreference)
Executes the pipeline and aggregates the output in to the type mapped by the target type.
|
<U> Iterator<U> |
aggregate(String collectionName,
Class<U> target,
AggregationOptions options,
ReadPreference readPreference)
Executes the pipeline and aggregates the output in to the type mapped by the target type.
|
AggregationPipeline |
geoNear(GeoNear geoNear)
Returns an ordered stream of documents based on the proximity to a geospatial point.
|
AggregationPipeline |
group(List<Group> id,
Group... groupings) |
AggregationPipeline |
group(String id,
Group... groupings)
Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group .
|
AggregationPipeline |
limit(int count)
Passes the first n documents unmodified to the pipeline where n is the specified limit.
|
AggregationPipeline |
lookup(String from,
String localField,
String foreignField,
String as)
Performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for
processing.
|
AggregationPipeline |
match(Query query)
Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage.
|
<U> Iterator<U> |
out(Class<U> target)
Places the output of the aggregation in the collection mapped by the target type using the default options as defined in
AggregationOptions. |
<U> Iterator<U> |
out(Class<U> target,
AggregationOptions options)
Places the output of the aggregation in the collection mapped by the target type.
|
<U> Iterator<U> |
out(String collectionName,
Class<U> target)
Places the output of the aggregation in the collection mapped by the target type using the default options as defined in
AggregationOptions. |
<U> Iterator<U> |
out(String collectionName,
Class<U> target,
AggregationOptions options)
Places the output of the aggregation in the collection mapped by the target type.
|
AggregationPipeline |
project(Projection... projections)
Reshapes each document in the stream, such as by adding new fields or removing existing fields.
|
AggregationPipeline |
skip(int count)
Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline.
|
AggregationPipeline |
sort(Sort... sorts)
Reorders the document stream by a specified sort key.
|
AggregationPipeline |
unwind(String field)
Deconstructs an array field from the input documents to output a document for each element.
|
<U> Iterator<U> aggregate(Class<U> target)
AggregationOptions.U - type of the resultstarget - The class to use when iterating over the results<U> Iterator<U> aggregate(Class<U> target, AggregationOptions options)
U - type of the resultstarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregation<U> Iterator<U> aggregate(Class<U> target, AggregationOptions options, ReadPreference readPreference)
U - type of the resultstarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregationreadPreference - The read preference to apply to this pipeline<U> Iterator<U> aggregate(String collectionName, Class<U> target, AggregationOptions options, ReadPreference readPreference)
U - type of the resultscollectionName - The collection in which to store the results of the aggregation overriding the mapped value in targettarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregationreadPreference - The read preference to apply to this pipelineAggregationPipeline geoNear(GeoNear geoNear)
geoNear - the geospatial parameters to apply to the pipelineAggregationPipeline group(String id, Group... groupings)
id - the ID of the group creategroupings - the group definitionsAggregationPipeline group(List<Group> id, Group... groupings)
id - the ID of the group creategroupings - the group definitionsgroup(String, Group...)AggregationPipeline limit(int count)
count - the maximum number of documents to returnAggregationPipeline lookup(String from, String localField, String foreignField, String as)
from - the collection to joinlocalField - the field from the input documentsforeignField - the field from the documents of the "from" collectionas - the output array fieldAggregationPipeline match(Query query)
query - the query to use when matching<U> Iterator<U> out(Class<U> target)
AggregationOptions.U - type of the resultstarget - The class to use when iterating over the results<U> Iterator<U> out(Class<U> target, AggregationOptions options)
U - type of the resultstarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregation<U> Iterator<U> out(String collectionName, Class<U> target)
AggregationOptions.U - type of the resultscollectionName - The collection in which to store the results of the aggregation overriding the mapped value in targettarget - The class to use when iterating over the results<U> Iterator<U> out(String collectionName, Class<U> target, AggregationOptions options)
U - type of the resultscollectionName - The collection in which to store the results of the aggregation overriding the mapped value in targettarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregationAggregationPipeline project(Projection... projections)
projections - the projections to apply to this pipelineAggregationPipeline skip(int count)
count - the number of documents to skipAggregationPipeline sort(Sort... sorts)
sorts - the sorts to apply to this pipelineAggregationPipeline unwind(String field)
field - the field to unwind