public class RedactOperation extends Object implements 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();
| Modifier and Type | Class and Description |
|---|---|
static class |
RedactOperation.RedactOperationBuilder
Builder to create new instance of
RedactOperation. |
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCEND
Return fields at the current document level.
|
static String |
KEEP
Return/Keep all fields at the current document/embedded level.
|
static String |
PRUNE
Exclude all fields at this current document/embedded level.
|
| Constructor and Description |
|---|
RedactOperation(AggregationExpression condition)
Create new
RedactOperation. |
| Modifier and Type | Method and Description |
|---|---|
static RedactOperation.RedactOperationBuilder |
builder()
Obtain a new instance of
RedactOperation.RedactOperationBuilder to specify condition and outcome of the $redact
operation. |
org.bson.Document |
toDocument(AggregationOperationContext context)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoPipelineStagespublic static final String DESCEND
public static final String KEEP
public static final String PRUNE
public RedactOperation(AggregationExpression condition)
RedactOperation.condition - Any AggregationExpression that resolves to $$DESCEND, $$PRUNE, or
$$KEEP. Must not be null.public org.bson.Document toDocument(AggregationOperationContext context)
AggregationOperationtoDocument in interface AggregationOperationcontext - the AggregationOperationContext to operate within. Must not be null.public static RedactOperation.RedactOperationBuilder builder()
RedactOperation.RedactOperationBuilder to specify condition and outcome of the $redact
operation.RedactOperation.RedactOperationBuilder.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.