Class RedactOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.RedactOperation
- All Implemented Interfaces:
AggregationOperation
RedactOperation
allows to restrict the content of a Document
based on information stored within
itself.
RedactOperation.builder() // .when(Criteria.where("level").is(5)) // .thenPrune() // .otherwiseDescend() // .build();
- Since:
- 3.0
- Author:
- Christoph Strobl
- See Also:
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRedactOperation
(AggregationExpression condition) Create newRedactOperation
. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Obtain a new instance ofRedactOperation.RedactOperationBuilder
to specify condition and outcome of the $redact operation.Return the MongoDB operator that is used for thisAggregationOperation
.org.bson.Document
toDocument
(AggregationOperationContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.core.aggregation.AggregationOperation
toPipelineStages
-
Field Details
-
DESCEND
Return fields at the current document level. Exclude embedded ones.- See Also:
-
KEEP
Return/Keep all fields at the current document/embedded level.- See Also:
-
PRUNE
Exclude all fields at this current document/embedded level.- See Also:
-
-
Constructor Details
-
RedactOperation
Create newRedactOperation
.- Parameters:
condition
- AnyAggregationExpression
that resolves to $$DESCEND, $$PRUNE, or $$KEEP. Must not be null.
-
-
Method Details
-
toDocument
Description copied from interface:AggregationOperation
- Specified by:
toDocument
in interfaceAggregationOperation
- Parameters:
context
- theAggregationOperationContext
to operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperation
Return the MongoDB operator that is used for thisAggregationOperation
. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperator
in interfaceAggregationOperation
- Returns:
- the operator used for this
AggregationOperation
.
-
builder
Obtain a new instance ofRedactOperation.RedactOperationBuilder
to specify condition and outcome of the $redact operation.- Returns:
- new instance of
RedactOperation.RedactOperationBuilder
.
-