Package dev.morphia.aggregation.stages
Class Projection
- java.lang.Object
-
- dev.morphia.aggregation.stages.Stage
-
- dev.morphia.aggregation.stages.Projection
-
public class Projection extends Stage
Passes along the documents with the requested fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Projection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Projection
exclude(String name)
Excludes a field.List<dev.morphia.aggregation.expressions.impls.PipelineField>
getFields()
Projection
include(String name)
Includes a field.Projection
include(String name, dev.morphia.aggregation.expressions.impls.Expression value)
Includes a field.static Projection
of()
Deprecated, for removal: This API element is subject to removal in a future version.useproject()
static Projection
project()
Creates a new stageProjection
suppressId()
Suppresses the _id field in the resulting document.-
Methods inherited from class dev.morphia.aggregation.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
of
@Deprecated(forRemoval=true) public static Projection of()
Deprecated, for removal: This API element is subject to removal in a future version.useproject()
Creates a new stage- Returns:
- the new stage
-
project
public static Projection project()
Creates a new stage- Returns:
- the new stage
- Since:
- 2.2
-
exclude
public Projection exclude(String name)
Excludes a field.- Parameters:
name
- the field name- Returns:
- this
-
getFields
@MorphiaInternal public List<dev.morphia.aggregation.expressions.impls.PipelineField> getFields()
- Returns:
- the fields
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
include
public Projection include(String name, dev.morphia.aggregation.expressions.impls.Expression value)
Includes a field.- Parameters:
name
- the field namevalue
- the value expression- Returns:
- this
-
include
public Projection include(String name)
Includes a field.- Parameters:
name
- the field name- Returns:
- this
-
suppressId
public Projection suppressId()
Suppresses the _id field in the resulting document.- Returns:
- this
-
-