public class AggregationPipelineImpl extends Object implements AggregationPipeline
| Constructor and Description |
|---|
AggregationPipelineImpl(DatastoreImpl datastore,
Class source)
Creates an 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.
|
List<DBObject> |
getStages()
Returns the internal list of stages for this pipeline.
|
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.
|
String |
toString() |
AggregationPipeline |
unwind(String field)
Deconstructs an array field from the input documents to output a document for each element.
|
public AggregationPipelineImpl(DatastoreImpl datastore, Class source)
datastore - the datastore to usesource - the source type to aggregatepublic List<DBObject> getStages()
public <U> Iterator<U> aggregate(Class<U> target)
AggregationPipelineAggregationOptions.aggregate in interface AggregationPipelineU - type of the resultstarget - The class to use when iterating over the resultspublic <U> Iterator<U> aggregate(Class<U> target, AggregationOptions options)
AggregationPipelineaggregate in interface AggregationPipelineU - type of the resultstarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregationpublic <U> Iterator<U> aggregate(Class<U> target, AggregationOptions options, ReadPreference readPreference)
AggregationPipelineaggregate in interface AggregationPipelineU - 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 pipelinepublic <U> Iterator<U> aggregate(String collectionName, Class<U> target, AggregationOptions options, ReadPreference readPreference)
AggregationPipelineaggregate in interface AggregationPipelineU - 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 pipelinepublic AggregationPipeline geoNear(GeoNear geoNear)
AggregationPipelinegeoNear in interface AggregationPipelinegeoNear - the geospatial parameters to apply to the pipelinepublic AggregationPipeline group(String id, Group... groupings)
AggregationPipelinegroup in interface AggregationPipelineid - the ID of the group creategroupings - the group definitionspublic AggregationPipeline group(List<Group> id, Group... groupings)
group in interface AggregationPipelineid - the ID of the group creategroupings - the group definitionsAggregationPipeline.group(String, Group...)public AggregationPipeline limit(int count)
AggregationPipelinelimit in interface AggregationPipelinecount - the maximum number of documents to returnpublic AggregationPipeline lookup(String from, String localField, String foreignField, String as)
AggregationPipelinelookup in interface AggregationPipelinefrom - the collection to joinlocalField - the field from the input documentsforeignField - the field from the documents of the "from" collectionas - the output array fieldpublic AggregationPipeline match(Query query)
AggregationPipelinematch in interface AggregationPipelinequery - the query to use when matchingpublic <U> Iterator<U> out(Class<U> target)
AggregationPipelineAggregationOptions.out in interface AggregationPipelineU - type of the resultstarget - The class to use when iterating over the resultspublic <U> Iterator<U> out(Class<U> target, AggregationOptions options)
AggregationPipelineout in interface AggregationPipelineU - type of the resultstarget - The class to use when iterating over the resultsoptions - The options to apply to this aggregationpublic <U> Iterator<U> out(String collectionName, Class<U> target)
AggregationPipelineAggregationOptions.out in interface AggregationPipelineU - 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 resultspublic <U> Iterator<U> out(String collectionName, Class<U> target, AggregationOptions options)
AggregationPipelineout in interface AggregationPipelineU - 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 aggregationpublic AggregationPipeline project(Projection... projections)
AggregationPipelineproject in interface AggregationPipelineprojections - the projections to apply to this pipelinepublic AggregationPipeline skip(int count)
AggregationPipelineskip in interface AggregationPipelinecount - the number of documents to skippublic AggregationPipeline sort(Sort... sorts)
AggregationPipelinesort in interface AggregationPipelinesorts - the sorts to apply to this pipelinepublic AggregationPipeline unwind(String field)
AggregationPipelineunwind in interface AggregationPipelinefield - the field to unwind