Class AggregationPipeline
java.lang.Object
org.springframework.data.mongodb.core.aggregation.AggregationPipeline
The
AggregationPipeline
holds the collection of aggregation stages
.- Since:
- 3.0.2
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty pipelineAggregationPipeline
(List<AggregationOperation> aggregationOperations) Create a new pipeline with givenstages
. -
Method Summary
Modifier and TypeMethodDescriptionadd
(AggregationOperation aggregationOperation) Append the givenstage
to the pipeline.boolean
Return whether this aggregation pipeline defines a$unionWith
stage that may contribute documents from other collections.Get the list ofaggregation stages
.boolean
isEmpty()
boolean
static AggregationPipeline
of
(AggregationOperation... stages)
-
Constructor Details
-
AggregationPipeline
public AggregationPipeline()Create an empty pipeline -
AggregationPipeline
Create a new pipeline with givenstages
.- Parameters:
aggregationOperations
- must not be null.
-
-
Method Details
-
of
-
add
Append the givenstage
to the pipeline.- Parameters:
aggregationOperation
- must not be null.- Returns:
- this.
-
getOperations
Get the list ofaggregation stages
.- Returns:
- never null.
-
isOutOrMerge
public boolean isOutOrMerge()- Returns:
- true if the last aggregation stage is either $out or $merge.
-
containsUnionWith
public boolean containsUnionWith()Return whether this aggregation pipeline defines a$unionWith
stage that may contribute documents from other collections. Checking for presence of union stages is useful when attempting to determine the aggregation element type for mapping metadata computation.- Returns:
- true the aggregation pipeline makes use of
$unionWith
. - Since:
- 3.1
-
isEmpty
public boolean isEmpty()- Returns:
- true if the pipeline does not contain any stages.
- Since:
- 3.1
-