
AccessPlan.prototype.result( outputType as String, [bindings as String], [options as String[]] ) as IteratePlan
This method executes the plan (mapping or reducing, if specified) to generate the result, which is a plan, document plan, prepared plan, or map or reduce result plan.
Unless otherwise mapped or reduced, each row is returned as a sem.binding object with a property for each column that exists in the row.
result is a method of the following classes:
// Sets output type to array.
const op = require('/MarkLogic/optic');
op.fromView('main', 'employees')
.select(['EmployeeID', 'FirstName', 'LastName'])
.result('object');
// Using parameter bindings.
const op = require('/MarkLogic/optic');
const employees = op.fromView('main', 'employees');
employees.offsetLimit(op.param('start'), op.param('length'))
.select(['EmployeeID',
op.as('incremented', op.add(op.col('EmployeeID'), op.param('increment')))])
.result(null, {start:1, length:2, increment:1});
const op = require('/MarkLogic/optic');
op.fromView('main', 'employees')orderdef
.select(['EmployeeID', 'FirstName', 'LastName'])
.orderBy('EmployeeID')
.result(null, null, ['trace=myQuery', 'optimize=1']);
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.