op.columnInfo

op.columnInfo(
   plan as PreparePlan
) as Array

Summary

This function can be used to inspect the state of a plan before execution. It returns the information about each column in the plan, including schema name, view name, column name, data type and nullability. It also returns the information about system columns.

Parameters
plan The plan to be inspected.

Usage Notes

Method columnInfo() cannot inspect the columns after a map() or reduce().

Example

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

op.fromView('main', 'employees').columnInfo();

/* results may look like below
{"schema":"opticUnitTest", "view":"musician", "column":"lastName", "type":"string", "nullable":false}
{"schema":"opticUnitTest", "view":"musician", "column":"firstName", "type":"string", "nullable":false}
{"schema":"opticUnitTest", "view":"musician", "column":"dob", "type":"date", "nullable":false}
{"schema":"opticUnitTest", "view":"musician", "column":"rowid", "type":"rowid", "nullable":false}
{"schema":"opticUnitTest", "view":"musician", "column":"__docid", "type":"fraghint", "nullable":false}
{"schema":"opticUnitTest", "view":"musician", "column":"__content", "type":"value", "nullable":false}
*/

  
Powered by MarkLogic Server | Terms of Use | Privacy Policy