Namespace: BuiltQuery
valuesBuilder. BuiltQuery
An object representing the result of
building a query using the helper functions of a valuesBuilder. You must call the valuesBuilder#fromIndexes
function to create the initial BuiltQuery for the values query
before calling the functions to specify the other clauses of the
built query.
Methods
-
-
aggregates(functions) → {valuesBuilder.BuiltQuery}
-
Specifies aggregates to calculate over the tuples (aka rows) projected from the indexes for the documents selected by the where clause. This function must be called on the builtQuery returned by the valuesBuilder#valuesFromIndexes function or another function specifying a values query clause.
Parameters:
Name Type Description functions
Array.<string> one or more built-in functions such avg, correlation, count, covariance, covariance-population, max, median, min, stddev, stddev-population, sum, variance, or variance-population or the return values from the valuesBuilder#udf function specifying a user-defined aggregate function. - Since:
-
- 1.0
Returns:
a built query -
-
slice(start, length, transform) → {valuesBuilder.BuiltQuery}
-
Sets the slice clause of a built query to select the slice of the result set based on the start tuple within the result set and the number of tuples (aka rows) in the slice. This function must be called on the builtQuery returned by the valuesBuilder#valuesFromIndexes function or another function specifying a values query clause. By default, the slice uses array slice mode, but you can switch to legacy slice mode with marklogic.setSliceMode. Legacy slice mode is deprecated and will be removed in the next major release.
Parameters:
Name Type Argument Description start
number in array slice mode, the zero-based position within the result set of the first tuple; in legacy slice mode, the one-based position within the result set of the first tuple or 0 to suppress the tuples and return only the summary length
number in array slice mode, the zero-based position of the tuple after the last document in the slice or 0 to suppress the documents and return only the summary; in legacy slice mode, the number of tuples in the slice transform
transform <optional>
a transform to apply to the slice on the server as specified by the valuesBuilder#transform function - Since:
-
- 1.0
Returns:
a built query -
-
where(query) → {valuesBuilder.BuiltQuery}
-
Sets the where clause of a values query, using the helper functions of a valuesBuilder to specify a structured query. This function must be called on the builtQuery returned by the valuesBuilder#valuesFromIndexes function or another function specifying a values query clause.
Parameters:
Name Type Description query
queryBuilder.Query one or more composable queries returned by the values query builder functions. - Since:
-
- 1.0
Returns:
a built query -
-
withOptions(forestNames, values) → {valuesBuilder.BuiltQuery}
-
Sets the withOptions clause of a built query to configure the query; takes a configuration object with the following named parameters. This function must be called on the builtQuery returned by the valuesBuilder#valuesFromIndexes function or another function specifying a values query clause.
Parameters:
Name Type Argument Description forestNames
string <optional>
<repeatable>
the names of forests providing documents for the result set values
string <optional>
<repeatable>
options modifying the default behaviour of the query - Since:
-
- 1.0
Returns:
a built query