Class AggregationPipelineImpl
- java.lang.Object
-
- dev.morphia.aggregation.AggregationPipelineImpl
-
- All Implemented Interfaces:
AggregationPipeline
@Deprecated(since="2.0", forRemoval=true) public class AggregationPipelineImpl extends Object implements AggregationPipeline
Deprecated, for removal: This API element is subject to removal in a future version.Implementation of an AggregationPipeline.
-
-
Constructor Summary
Constructors Constructor Description AggregationPipelineImpl(Datastore datastore, MongoCollection collection, Class source)
Deprecated, for removal: This API element is subject to removal in a future version.Creates an AggregationPipeline
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <U> Iterator<U>
aggregate(Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Executes the pipeline and aggregates the output in to the type mapped by the target type using the default options as defined inAggregationOptions
.<U> Iterator<U>
aggregate(Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.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)
Deprecated, for removal: This API element is subject to removal in a future version.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)
Deprecated, for removal: This API element is subject to removal in a future version.Executes the pipeline and aggregates the output in to the type mapped by the target type.AggregationPipeline
bucket(String field, List<?> boundaries)
Deprecated, for removal: This API element is subject to removal in a future version.Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.AggregationPipeline
bucket(String field, List<?> boundaries, BucketOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.AggregationPipeline
bucketAuto(String field, int bucketCount)
Deprecated, for removal: This API element is subject to removal in a future version.Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.AggregationPipeline
bucketAuto(String field, int bucketCount, BucketAutoOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.AggregationPipeline
geoNear(GeoNear geoNear)
Deprecated, for removal: This API element is subject to removal in a future version.Returns an ordered stream of documents based on the proximity to a geospatial point.AggregationPipeline
group(Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group .AggregationPipeline
group(String id, Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group.AggregationPipeline
group(List<Group> id, Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.AggregationPipeline
limit(int count)
Deprecated, for removal: This API element is subject to removal in a future version.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)
Deprecated, for removal: This API element is subject to removal in a future version.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)
Deprecated, for removal: This API element is subject to removal in a future version.Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage.<U> Iterator<U>
out(Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Places the output of the aggregation in the collection mapped by the target type using the default options as defined inAggregationOptions
.<U> Iterator<U>
out(Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Places the output of the aggregation in the collection mapped by the target type.<U> Iterator<U>
out(String collectionName, Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Places the output of the aggregation in the collection mapped by the target type using the default options as defined inAggregationOptions
.<U> Iterator<U>
out(String collectionName, Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Places the output of the aggregation in the collection mapped by the target type.AggregationPipeline
project(Projection... projections)
Deprecated, for removal: This API element is subject to removal in a future version.Reshapes each document in the stream, such as by adding new fields or removing existing fields.AggregationPipeline
sample(int sampleSize)
Deprecated, for removal: This API element is subject to removal in a future version.Randomly selects the specified number of documents from the previous pipeline stage.AggregationPipeline
skip(int count)
Deprecated, for removal: This API element is subject to removal in a future version.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)
Deprecated, for removal: This API element is subject to removal in a future version.Reorders the document stream by a specified sort key.AggregationPipeline
sortByCount(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.String
toString()
Deprecated, for removal: This API element is subject to removal in a future version.AggregationPipeline
unwind(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Deconstructs an array field from the input documents to output a document for each element.AggregationPipeline
unwind(String field, UnwindOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Deconstructs an array field from the input documents to output a document for each element.
-
-
-
Constructor Detail
-
AggregationPipelineImpl
public AggregationPipelineImpl(Datastore datastore, MongoCollection collection, Class source)
Deprecated, for removal: This API element is subject to removal in a future version.Creates an AggregationPipeline- Parameters:
datastore
- the datastore to usecollection
- the database collection on which to operatesource
- the source type to aggregate
-
-
Method Detail
-
aggregate
public <U> Iterator<U> aggregate(Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Executes the pipeline and aggregates the output in to the type mapped by the target type using the default options as defined inAggregationOptions
. Note: This return type will change toMongoCursor
in 2.0 to allow for finer-grained control of iteration and resource management.- Specified by:
aggregate
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
target
- The class to use when iterating over the results- Returns:
- an iterator of the computed results
-
aggregate
public <U> Iterator<U> aggregate(Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change toMongoCursor
in 2.0 to allow for finer-grained control of iteration and resource management.- Specified by:
aggregate
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
target
- The class to use when iterating over the resultsoptions
- The options to apply to this aggregation- Returns:
- an iterator of the computed results
-
aggregate
public <U> Iterator<U> aggregate(Class<U> target, AggregationOptions options, ReadPreference readPreference)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change toMongoCursor
in 2.0 to allow for finer-grained control of iteration and resource management.- Specified by:
aggregate
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
target
- The class to use when iterating over the resultsoptions
- The options to apply to this aggregationreadPreference
- The read preference to apply to this pipeline- Returns:
- an iterator of the computed results
-
aggregate
public <U> Iterator<U> aggregate(String collectionName, Class<U> target, AggregationOptions options, ReadPreference readPreference)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change toMongoCursor
in 2.0 to allow for finer-grained control of iteration and resource management.- Specified by:
aggregate
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
collectionName
- 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 pipeline- Returns:
- an iterator of the computed results
-
bucket
public AggregationPipeline bucket(String field, List<?> boundaries)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound of the bucket and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.
- Specified by:
bucket
in interfaceAggregationPipeline
- Parameters:
field
- the field that used as groupby for bucketingboundaries
- An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries.- Returns:
- this
-
bucket
public AggregationPipeline bucket(String field, List<?> boundaries, BucketOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound of the bucket and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.
- Specified by:
bucket
in interfaceAggregationPipeline
- Parameters:
field
- the field that used as groupby for bucketingboundaries
- An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries.options
- options that include defaultField for values that not match in any boundaries and also allow to specify output by using accumulatorAccumulator
- Returns:
- this
-
bucketAuto
public AggregationPipeline bucketAuto(String field, int bucketCount)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound and the exclusive upper bound for the bucket, and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.
- Specified by:
bucketAuto
in interfaceAggregationPipeline
- Parameters:
field
- the field that used as groupby for auto bucketingbucketCount
- the number of buckets into which input documents are grouped- Returns:
- this
-
bucketAuto
public AggregationPipeline bucketAuto(String field, int bucketCount, BucketAutoOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound and the exclusive upper bound for the bucket, and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.
- Specified by:
bucketAuto
in interfaceAggregationPipeline
- Parameters:
field
- the field that used as groupby for auto bucketingbucketCount
- the number of buckets into which input documents are groupedoptions
- options that include granularity for buckets and output- Returns:
- this
-
geoNear
public AggregationPipeline geoNear(GeoNear geoNear)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field.- Specified by:
geoNear
in interfaceAggregationPipeline
- Parameters:
geoNear
- the geospatial parameters to apply to the pipeline- Returns:
- this
-
group
public AggregationPipeline group(Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group . Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. The ID for this group is null.- Specified by:
group
in interfaceAggregationPipeline
- Parameters:
groupings
- the group definitions- Returns:
- this
-
group
public AggregationPipeline group(@Nullable String id, Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields.- Specified by:
group
in interfaceAggregationPipeline
- Parameters:
id
- the ID of the group creategroupings
- the group definitions- Returns:
- this
-
group
public AggregationPipeline group(List<Group> id, Group... groupings)
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
group
in interfaceAggregationPipeline
- Parameters:
id
- the ID of the group creategroupings
- the group definitions- Returns:
- this
- See Also:
AggregationPipeline.group(String, Group...)
-
limit
public AggregationPipeline limit(int count)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents).- Specified by:
limit
in interfaceAggregationPipeline
- Parameters:
count
- the maximum number of documents to return- Returns:
- this
-
lookup
public AggregationPipeline lookup(String from, String localField, String foreignField, String as)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing. The $lookup stage does an equality match between a field from the input documents with a field from the documents of the “joined” collection. To each input document, the $lookup stage adds a new array field whose elements are the matching documents from the “joined” collection. The $lookup stage passes these reshaped documents to the next stage.- Specified by:
lookup
in interfaceAggregationPipeline
- Parameters:
from
- the collection to joinlocalField
- the field from the input documentsforeignField
- the field from the documents of the "from" collectionas
- the output array field- Returns:
- this
-
match
public AggregationPipeline match(Query query)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match).- Specified by:
match
in interfaceAggregationPipeline
- Parameters:
query
- the query to use when matching- Returns:
- this
-
out
public <U> Iterator<U> out(Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Places the output of the aggregation in the collection mapped by the target type using the default options as defined inAggregationOptions
.- Specified by:
out
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
target
- The class to use when iterating over the results- Returns:
- an iterator of the computed results
-
out
public <U> Iterator<U> out(Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Places the output of the aggregation in the collection mapped by the target type.- Specified by:
out
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
target
- The class to use when iterating over the resultsoptions
- The options to apply to this aggregation- Returns:
- an iterator of the computed results
-
out
public <U> Iterator<U> out(String collectionName, Class<U> target)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Places the output of the aggregation in the collection mapped by the target type using the default options as defined inAggregationOptions
.- Specified by:
out
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
collectionName
- 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- Returns:
- an iterator of the computed results
-
out
public <U> Iterator<U> out(String collectionName, Class<U> target, AggregationOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Places the output of the aggregation in the collection mapped by the target type.- Specified by:
out
in interfaceAggregationPipeline
- Type Parameters:
U
- type of the results- Parameters:
collectionName
- 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 aggregation- Returns:
- an iterator of the computed results
-
project
public AggregationPipeline project(Projection... projections)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document.- Specified by:
project
in interfaceAggregationPipeline
- Parameters:
projections
- the projections to apply to this pipeline- Returns:
- this
-
sample
public AggregationPipeline sample(int sampleSize)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Randomly selects the specified number of documents from the previous pipeline stage.- Specified by:
sample
in interfaceAggregationPipeline
- Parameters:
sampleSize
- the number of documents to select- Returns:
- this
-
skip
public AggregationPipeline skip(int count)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents).- Specified by:
skip
in interfaceAggregationPipeline
- Parameters:
count
- the number of documents to skip- Returns:
- this
-
sort
public AggregationPipeline sort(Sort... sorts)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document.- Specified by:
sort
in interfaceAggregationPipeline
- Parameters:
sorts
- the sorts to apply to this pipeline- Returns:
- this
-
sortByCount
public AggregationPipeline sortByCount(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.Each output document contains two fields: an _id field containing the distinct grouping value, and a count field containing the number of documents belonging to that grouping or category.
- Specified by:
sortByCount
in interfaceAggregationPipeline
- Parameters:
field
- the field to sort by count- Returns:
- this
-
unwind
public AggregationPipeline unwind(String field, UnwindOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.- Specified by:
unwind
in interfaceAggregationPipeline
- Parameters:
field
- the field to unwindoptions
- unwind options- Returns:
- this
-
unwind
public AggregationPipeline unwind(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AggregationPipeline
Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.- Specified by:
unwind
in interfaceAggregationPipeline
- Parameters:
field
- the field to unwind- Returns:
- this
-
-