
op:execute( [$bindings as map:map?], [$options as xs:string*] ) as ()
This method executes the plan. The result is ignored. This function can be used in an Optic Update.
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
declare option xdmp:update "true";
let $permissions := (map:entry("roleName","rest-reader")=>map:with("capability","read"),
map:entry("roleName","rest-writer")=>map:with("capability","update"))
let $doc-descriptors := (
map:entry("uri", '/optic/update/execute9.xml')
=>map:with("doc", <doc>execute9</doc>)
=>map:with("collections", ("execute", "write"))
=>map:with("metadata", map:entry("time", "2022-10-13T11:00:0"))
=>map:with("permissions", $permissions)
=>map:with("quality", 9),
map:entry("uri", '/optic/update/execute10.xml')
=>map:with("doc", <doc>execute10</doc>)
=>map:with("collections", ("execute", "write"))
=>map:with("metadata", map:entry("time", "2022-10-13T11:00:0"))
=>map:with("permissions", $permissions)
=>map:with("quality", 10)
)
return op:from-doc-descriptors($doc-descriptors)
=>op:write()
=>op:execute()
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
declare option xdmp:update "true";
let $permissions := (map:entry("roleName","rest-reader")=>map:with("capability","read"),
map:entry("roleName","rest-writer")=>map:with("capability","update"))
let $rows := (
map:entry("uri", '/optic/update/execute5.xml')
=>map:with("doc", <doc>execute5</doc>)
=>map:with("collections", ("execute", "write"))
=>map:with("metadata", map:entry("time", "2022-10-13T11:00:0"))
=>map:with("permissions", $permissions)
=>map:with("quality", 5),
map:entry("uri", '/optic/update/execute6.xml')
=>map:with("doc", <doc>execute6</doc>)
=>map:with("collections", ("execute", "write"))
=>map:with("metadata", map:entry("time", "2022-10-13T11:00:0"))
=>map:with("permissions", $permissions)
=>map:with("quality", 6)
)
return op:from-param("bindingParam", (), op:doc-col-types())
=>op:write()
=>op:execute(map:entry("bindingParam",$rows), ("trace=fromParam", "optimize=1", "seed=2"))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.