MarkLogic 12 EA 1 Product Documentation
AccessPlan.prototype.execute

AccessPlan.prototype.execute(
   [bindings as String],
   [options as String[]]
) as null

Summary

This method executes the plan. The result is ignored. This function can be used in an Optic Update.

Parameters
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.

See Also

Example

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

op.fromDocDescriptors([{uri:"/test.xml"}])
.remove()
.execute(null, ['trace=myQuery', 'optimize=1']);
  

Example

declareUpdate();
const op = require('/MarkLogic/optic');
const rows =[
  {uri:'/optic/update/execute3.json', doc:{"doc":"execute3"}, collections:['execute', 'write'], quality:3, permissions:[xdmp.permission("rest-reader","read"),xdmp.permission("rest-writer","update")]},
  {uri:'/optic/update/execute4.json', doc:{"doc":"execute4"}, collections:['execute', 'write'], quality:4, permissions:[xdmp.permission("rest-reader","read"),xdmp.permission("rest-writer","update")]}
];
op.fromParam('bindingParam', null, op.docColTypes())
   .bind(op.as('metadata', op.jsonObject([op.prop('time', op.jsonString('2022-10-13T11:00:0'))])))
   .write()
   .execute({bindingParam:rows}, "trace=QueryFromParam");
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy