Loading TOC...

MarkLogic Server 11.0 Product Documentation
IteratePlan.prototype.export

IteratePlan.prototype.export() as Plan

Summary

This method generates a serialized representation of the Optic query to JSON so that it can be persisted as a file or used as a REST payload. Only the Optic query can be exported, not the results of executing an Optic query. A mapper or reducer function cannot be exported if it is an anonymous function. The export for a named function identifies the module path and function name.

For more information, see Exporting and Importing a Serialized Optic Query in the Application Developer's Guide

Usage Notes

export is a method of the following classes:

Example

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

const EmployeePlan =
  op.fromView('main', 'employees')
     .select(['EmployeeID', 'FirstName', 'LastName'])
     .orderBy('EmployeeID')
     const planObj = EmployeePlan.export();

xdmp.documentInsert("plan.json", planObj)

  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.