public class ProjectionOperation extends Object implements FieldsExposingAggregationOperation
$project-operation. Projection of field to be used in an
Aggregation. A projection is similar to a Field inclusion/exclusion but more powerful. It can
generate new fields, change values of given field etc.
http://docs.mongodb.org/manual/reference/aggregation/project/| Modifier and Type | Class and Description |
|---|---|
static class |
ProjectionOperation.ExpressionProjectionOperationBuilder
An
ProjectionOperation.ProjectionOperationBuilder that is used for SpEL expression based projections. |
static class |
ProjectionOperation.ProjectionOperationBuilder
Builder for
ProjectionOperations on a field. |
| Constructor and Description |
|---|
ProjectionOperation()
Creates a new empty
ProjectionOperation. |
ProjectionOperation(Fields fields)
Creates a new
ProjectionOperation including the given Fields. |
| Modifier and Type | Method and Description |
|---|---|
ProjectionOperation.ProjectionOperationBuilder |
and(String name)
Creates a new
ProjectionOperation.ProjectionOperationBuilder to define a projection for the field with the given name. |
ProjectionOperation |
andExclude(String... fieldNames)
Excludes the given fields from the projection.
|
ProjectionOperation.ExpressionProjectionOperationBuilder |
andExpression(String expression,
Object... params) |
ProjectionOperation |
andInclude(Fields fields)
Includes the given fields into the projection.
|
ProjectionOperation |
andInclude(String... fieldNames)
Includes the given fields into the projection.
|
ExposedFields |
getFields()
Returns the fields exposed by the
AggregationOperation. |
com.mongodb.DBObject |
toDBObject(AggregationOperationContext context)
|
public ProjectionOperation()
ProjectionOperation.public ProjectionOperation(Fields fields)
ProjectionOperation including the given Fields.fields - must not be null.public ProjectionOperation.ProjectionOperationBuilder and(String name)
ProjectionOperation.ProjectionOperationBuilder to define a projection for the field with the given name.name - must not be null or empty.public ProjectionOperation.ExpressionProjectionOperationBuilder andExpression(String expression, Object... params)
public ProjectionOperation andExclude(String... fieldNames)
fieldNames - must not be null.public ProjectionOperation andInclude(String... fieldNames)
fieldNames - must not be null.public ProjectionOperation andInclude(Fields fields)
fields - must not be null.public ExposedFields getFields()
FieldsExposingAggregationOperationAggregationOperation.getFields in interface FieldsExposingAggregationOperationpublic com.mongodb.DBObject toDBObject(AggregationOperationContext context)
AggregationOperationtoDBObject in interface AggregationOperationCopyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.