public class UnionWithOperation extends Object implements AggregationOperation
GroupOperation right after
UnionWithOperation.
UnionWithOperation uses a
pipeline
to process documents, field names within the pipeline will be treated as is. In order to map domain type property
names to actual field names (considering potential Field
annotations) make sure the enclosing aggregation is a TypedAggregation and provide the target type for the
$unionWith stage via mapFieldsTo(Class).| Constructor and Description |
|---|
UnionWithOperation(String collection,
AggregationPipeline pipeline,
Class<?> domainType) |
| Modifier and Type | Method and Description |
|---|---|
String |
getOperator()
Return the MongoDB operator that is used for this
AggregationOperation. |
UnionWithOperation |
mapFieldsTo(Class<?> domainType)
Set domain type used for field name mapping of property references used by the
AggregationPipeline. |
UnionWithOperation |
pipeline(AggregationOperation... aggregationStages)
Set the aggregation pipeline stages to apply to the specified collection.
|
UnionWithOperation |
pipeline(AggregationPipeline pipeline)
Set the
AggregationPipeline to apply to the specified collection. |
UnionWithOperation |
pipeline(List<AggregationOperation> aggregationStages)
Set the aggregation pipeline stages to apply to the specified collection.
|
org.bson.Document |
toDocument(AggregationOperationContext context)
|
static UnionWithOperation |
unionWith(String collection)
Set the name of the collection from which pipeline results should be included in the result set.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoPipelineStagespublic UnionWithOperation(String collection, @Nullable AggregationPipeline pipeline, @Nullable Class<?> domainType)
public static UnionWithOperation unionWith(String collection)
coll parameter of $unionWith.collection - the MongoDB collection name. Must not be null.UnionWithOperation.IllegalArgumentException - if the required argument is null.public UnionWithOperation pipeline(AggregationPipeline pipeline)
AggregationPipeline to apply to the specified collection. The pipeline corresponds to the optional
pipeline field of the $unionWith aggregation stage and is used to compute the documents going into
the result set.pipeline - the AggregationPipeline that computes the documents. Must not be null.UnionWithOperation.IllegalArgumentException - if the required argument is null.public UnionWithOperation pipeline(List<AggregationOperation> aggregationStages)
pipeline field of the $unionWith aggregation stage and is used to compute the documents going into
the result set.aggregationStages - the aggregation pipeline stages that compute the documents. Must not be null.UnionWithOperation.IllegalArgumentException - if the required argument is null.public UnionWithOperation pipeline(AggregationOperation... aggregationStages)
pipeline field of the $unionWith aggregation stage and is used to compute the documents going into
the result set.aggregationStages - the aggregation pipeline stages that compute the documents. Must not be null.UnionWithOperation.IllegalArgumentException - if the required argument is null.public UnionWithOperation mapFieldsTo(Class<?> domainType)
AggregationPipeline.
Remember to also use a TypedAggregation in the outer pipeline.pipeline operations are taken as is.domainType - the domain type to map field names used in pipeline operations to. Must not be null.UnionWithOperation.IllegalArgumentException - if the required argument is null.public org.bson.Document toDocument(AggregationOperationContext context)
AggregationOperationtoDocument in interface AggregationOperationcontext - the AggregationOperationContext to operate within. Must not be null.public String getOperator()
AggregationOperationAggregationOperation. Aggregation operations should
implement this method to avoid document rendering.getOperator in interface AggregationOperationAggregationOperation.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.