op.columnInfo( plan as PreparePlan ) as Array
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. |
Method columnInfo() cannot inspect the columns after a map() or reduce().
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} */
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.