public static class ProjectionOperation.ProjectionOperationBuilder extends Object
ProjectionOperations on a field.| Constructor and Description |
|---|
ProjectionOperationBuilder(String name,
ProjectionOperation operation,
org.springframework.data.mongodb.core.aggregation.ProjectionOperation.ProjectionOperationBuilder.OperationProjection previousProjection)
Creates a new
ProjectionOperation.ProjectionOperationBuilder for the field with the given name on top of the given
ProjectionOperation. |
| Modifier and Type | Method and Description |
|---|---|
ProjectionOperation |
as(String alias)
Allows to specify an alias for the previous projection operation.
|
ProjectionOperation.ProjectionOperationBuilder |
divide(Number number)
Generates an
$divide expression that divides the previously mentioned field by the given number. |
ProjectionOperation.ProjectionOperationBuilder |
divide(String fieldReference)
Generates an
$divide expression that divides the value of the given field by the previously mentioned
field. |
ProjectionOperation.ProjectionOperationBuilder |
minus(Number number)
Generates an
$subtract expression that subtracts the given number to the previously mentioned field. |
ProjectionOperation.ProjectionOperationBuilder |
minus(String fieldReference)
Generates an
$subtract expression that subtracts the value of the given field to the previously mentioned
field. |
ProjectionOperation.ProjectionOperationBuilder |
mod(Number number)
Generates an
$mod expression that divides the previously mentioned field by the given number and returns
the remainder. |
ProjectionOperation.ProjectionOperationBuilder |
mod(String fieldReference)
Generates an
$mod expression that divides the value of the given field by the previously mentioned field
and returns the remainder. |
ProjectionOperation.ProjectionOperationBuilder |
multiply(Number number)
Generates an
$multiply expression that multiplies the given number with the previously mentioned field. |
ProjectionOperation.ProjectionOperationBuilder |
multiply(String fieldReference)
Generates an
$multiply expression that multiplies the value of the given field with the previously
mentioned field. |
ProjectionOperation |
nested(Fields fields)
Defines a nested field binding for the current field.
|
ProjectionOperation.ProjectionOperationBuilder |
plus(Number number)
Generates an
$add expression that adds the given number to the previously mentioned field. |
ProjectionOperation.ProjectionOperationBuilder |
plus(String fieldReference)
Generates an
$add expression that adds the value of the given field to the previously mentioned field. |
ProjectionOperation |
previousOperation()
Projects the result of the previous operation onto the current field.
|
ProjectionOperation.ProjectionOperationBuilder |
project(String operation,
Object... values)
Adds a generic projection for the current field.
|
com.mongodb.DBObject |
toDBObject(AggregationOperationContext context)
|
public ProjectionOperationBuilder(String name, ProjectionOperation operation, org.springframework.data.mongodb.core.aggregation.ProjectionOperation.ProjectionOperationBuilder.OperationProjection previousProjection)
ProjectionOperation.ProjectionOperationBuilder for the field with the given name on top of the given
ProjectionOperation.name - must not be null or empty.operation - must not be null.previousProjection - the previous operation projection, may be null.public ProjectionOperation previousOperation()
_id as what would be held in it by default will now go into the field just projected into.public ProjectionOperation nested(Fields fields)
fields - must not be null.public ProjectionOperation as(String alias)
string - public ProjectionOperation.ProjectionOperationBuilder plus(Number number)
$add expression that adds the given number to the previously mentioned field.number - public ProjectionOperation.ProjectionOperationBuilder plus(String fieldReference)
$add expression that adds the value of the given field to the previously mentioned field.fieldReference - public ProjectionOperation.ProjectionOperationBuilder minus(Number number)
$subtract expression that subtracts the given number to the previously mentioned field.number - public ProjectionOperation.ProjectionOperationBuilder minus(String fieldReference)
$subtract expression that subtracts the value of the given field to the previously mentioned
field.fieldReference - public ProjectionOperation.ProjectionOperationBuilder multiply(Number number)
$multiply expression that multiplies the given number with the previously mentioned field.number - public ProjectionOperation.ProjectionOperationBuilder multiply(String fieldReference)
$multiply expression that multiplies the value of the given field with the previously
mentioned field.fieldReference - public ProjectionOperation.ProjectionOperationBuilder divide(Number number)
$divide expression that divides the previously mentioned field by the given number.number - public ProjectionOperation.ProjectionOperationBuilder divide(String fieldReference)
$divide expression that divides the value of the given field by the previously mentioned
field.fieldReference - public ProjectionOperation.ProjectionOperationBuilder mod(Number number)
$mod expression that divides the previously mentioned field by the given number and returns
the remainder.number - public ProjectionOperation.ProjectionOperationBuilder mod(String fieldReference)
$mod expression that divides the value of the given field by the previously mentioned field
and returns the remainder.fieldReference - public com.mongodb.DBObject toDBObject(AggregationOperationContext context)
AggregationOperationtoDBObject in interface AggregationOperationpublic ProjectionOperation.ProjectionOperationBuilder project(String operation, Object... values)
operation - the operation key, e.g. $add.values - the values to be set for the projection operation.Copyright © 2021. All rights reserved.