Class Projection
java.lang.Object
com.datastax.astra.client.core.query.Projection
Encode the presence of a field in the result.
-
Constructor Summary
ConstructorsConstructorDescriptionProjection(String field, boolean present) Default constructor.Projection(String field, Boolean present, Integer sliceStart, Integer sliceEnd) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic Projection[]Exclude a field in the result.static Projection[]Include a field in the result.static ProjectionSpecifies the number of elements in an array to return in the query result.
-
Constructor Details
-
Projection
Default constructor.- Parameters:
field- field valuepresent- tell if field is present
-
Projection
Default constructor.- Parameters:
field- field valuepresent- tell if field is presentsliceStart- start of slice (mutually exclusive with 'present')sliceEnd- end of slice (mutually exclusive with 'present'), optional
-
-
Method Details
-
include
Include a field in the result.- Parameters:
field- include field- Returns:
- name to include
-
slice
Specifies the number of elements in an array to return in the query result.// Return the first two elements { $slice: 2 } // Return the last two elements { $slice: -2 } // Skip 4 elements (from 0th index), return the next 2 { $slice: [4, 2] } // Skip backward 4 elements, return next 2 elements (forward) { $slice: [-4, 2] }- Parameters:
field- field name for slicestart- start index of sliceend- end index of slice- Returns:
- a projection for the slide
-
exclude
Exclude a field in the result.- Parameters:
field- field name to exclude- Returns:
- list of projection
-