MarkLogic 10 Product Documentation
op.namedGroup

op.namedGroup(
   name as String,
   [columns as columnIdentifier[]]
) as groupdef

Summary

This function specifies the grouping keys for a group as a named list of zero or more columns. The result is used for building the first parameter for the prototype.groupToArrays function.

Parameters
name The name for the list of grouping keys.
columns The columns (if any) to use as grouping keys. The columns can be named with a string or a column parameter function such as op.col or constructed from an expression with op.as.

See Also

Example

const op = require('/MarkLogic/optic');

op.fromView('main', 'expenses')
   .groupToArrays(
       [op.namedGroup('total'), op.namedGroup('byCategoryLocation', ['Category', 'Location'])],
       op.sum("TotalAmount", "Amount"))
   .result();

  
Powered by MarkLogic Server | Terms of Use | Privacy Policy