MarkLogic 12 EA 1 Product Documentation
op:patch-builder

op:patch-builder(
   $context-path as xs:string,
   $namespaces as map:map()?
) as map:map

Summary

Create a patch builder which can be used to chain patch operations.

Parameters
$context-path The context path to patch.
$namespaces Namespaces prefix (key) and uri (value).

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";
declare option xdmp:update "true";

let $doc-descriptors := (
    map:entry("uri", '/optic/update/write4.xml')
      =>map:with("doc", <doc><action>write4</action></doc>),
    map:entry("uri", '/optic/update/write5.xml')
      =>map:with("doc", <doc><action>write4</action></doc>)
      =>map:with("collections", ("write"))
  )
return op:from-doc-descriptors($doc-descriptors)
=>op:patch(op:col("doc"),op:patch-builder("/",())
           =>op:insert-after("action",<status>NEW</status>)
          )
=>op:write(op:doc-cols())
=>op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy