Class ReplaceWithOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
org.springframework.data.mongodb.core.aggregation.ReplaceWithOperation
- All Implemented Interfaces:
AggregationOperation, FieldsExposingAggregationOperation
Encapsulates the aggregation framework
The operation replaces all existing fields including the
$replaceRoot-operation. The operation replaces all existing fields including the
id field with @{code $replaceWith}. This way it is
possible to promote an embedded document to the top-level or specify a new document.- Since:
- 3.0
- Author:
- Christoph Strobl
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ReplaceRootOperation
ReplaceRootOperation.Replacement, ReplaceRootOperation.ReplaceRootDocumentOperation, ReplaceRootOperation.ReplaceRootDocumentOperationBuilder, ReplaceRootOperation.ReplaceRootOperationBuilderNested classes/interfaces inherited from interface FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation -
Constructor Summary
ConstructorsConstructorDescriptionReplaceWithOperation(ReplaceRootOperation.Replacement replacement) Creates new instance ofReplaceWithOperation. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReplaceWithOperationreplaceWithValue(Object value) Creates new instance ofReplaceWithOperation.static ReplaceWithOperationreplaceWithValueOf(Object value) org.bson.DocumenttoDocument(AggregationOperationContext context) Methods inherited from class ReplaceRootOperation
builder, getFields, getOperator, getReplacementMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AggregationOperation
toPipelineStagesMethods inherited from interface FieldsExposingAggregationOperation
inheritsFields
-
Constructor Details
-
ReplaceWithOperation
Creates new instance ofReplaceWithOperation.- Parameters:
replacement- must not be null.
-
-
Method Details
-
replaceWithValue
Creates new instance ofReplaceWithOperation.- Parameters:
value- must not be null.- Returns:
- new instance of
ReplaceWithOperation.
-
replaceWithValueOf
- Parameters:
value- must not be null.- Returns:
- new instance of
ReplaceWithOperation.
-
toDocument
Description copied from interface:AggregationOperation- Specified by:
toDocumentin interfaceAggregationOperation- Overrides:
toDocumentin classReplaceRootOperation- Parameters:
context- theAggregationOperationContextto operate within. Must not be null.- Returns:
- the Document
-