Package dev.morphia.query
Class Projection
java.lang.Object
dev.morphia.query.Projection
Defines a query projection
-
Method Summary
Modifier and TypeMethodDescriptionAdds a field to the projection clause.Adds a field to the projection clause.Configure the project to only return known, mapped fieldsConverts this to Document formAdds a metadata field to a projection.project(String field, ArraySlice slice) Adds an sliced array field to a projection.toString()
-
Method Details
-
exclude
Adds a field to the projection clause. The _id field is always included unless explicitly suppressed.- Parameters:
fields- the fields to exclude- Returns:
- this
- See Also:
-
include
Adds a field to the projection clause. The _id field is always included unless explicitly suppressed.- Parameters:
fields- the fields to include- Returns:
- this
- See Also:
-
knownFields
Configure the project to only return known, mapped fields- Returns:
- this
-
map
Converts this to Document form- Parameters:
mapper- the Mapper to usetype- the entity type- Returns:
- this
-
project
Adds an sliced array field to a projection.- Parameters:
field- the field to projectslice- the options for projecting an array field- Returns:
- this
- See Also:
- MongoDB documentation
- $slice
-
project
Adds a metadata field to a projection.- Parameters:
meta- the metadata option for projecting- Returns:
- this
- See Also:
- MongoDB documentation
- $meta
-
toString
-