Package com.datastax.astra.client.model
Class Projections
java.lang.Object
com.datastax.astra.client.model.Projections
Encode the presence of a field in the result.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Projection[]
Exclude a field in the result.static Projection[]
Include a field in the result.static Projection
Specifies the number of elements in an array to return in the query result.
-
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
-