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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRedactOperation(AggregationExpression condition) Create newRedactOperation. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Obtain a new instance ofRedactOperation.RedactOperationBuilderto specify condition and outcome of the $redact operation.Return the MongoDB operator that is used for thisAggregationOperation.org.bson.DocumenttoDocument(AggregationOperationContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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- AnyAggregationExpressionthat resolves to $$DESCEND, $$PRUNE, or $$KEEP. Must not be null.
-
-
Method Details
-
toDocument
Description copied from interface:AggregationOperation- Specified by:
toDocumentin interfaceAggregationOperation- Parameters:
context- theAggregationOperationContextto operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperationReturn the MongoDB operator that is used for thisAggregationOperation. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperatorin interfaceAggregationOperation- Returns:
- the operator used for this
AggregationOperation.
-
builder
Obtain a new instance ofRedactOperation.RedactOperationBuilderto specify condition and outcome of the $redact operation.- Returns:
- new instance of
RedactOperation.RedactOperationBuilder.
-