Loading TOC...

MarkLogic 10 Product Documentation
PreparePlan.prototype.result

PreparePlan.prototype.result(
   outputType as String,
   [bindings as String],
   [options as String[]]
) as IteratePlan

Summary

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.

Parameters
outputType This parameter specifies the outputType as either "object" (the default) for a JavaScript object with keys of the column names and values of the column values or "array" for a JavaScript array.
bindings This parameter provides a JavaScript literal object with the names and values of placeholder parameters. An error is thrown if a placeholder parameter is not bound.
options Options as an array of string values. Available options are:
  • "trace=ID"

    This parameter outputs the query's plan, optimization and execution details in the log while getting results. ID is the identifier to identify the query in the logs.

  • "optimize=N"

    Sets the optimization level to use. Levels of 0 (off), 1, and 2 are recognized. The default is 1.

  • "seed=N"

    Sets the seed to use. The default will generate a random seed. Setting it to 0 will behave the same as the default case. The default is 0.

Usage Notes

result is a method of the following classes:

See Also

Example

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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.