MarkLogic Server 11.0 Product Documentation
op.prototype.patchBuilder

op.prototype.patchBuilder(
   contextPath as String,
   namespaces as Object?
) as PatchBuilderPlan

Summary

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

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

Example

'use strict';
declareUpdate();
const op = require('/MarkLogic/optic');
const docDescriptors = [{uri: '/optic/update/write4.xml',doc:xdmp.unquote("<doc><action>write4</action></doc>")},
                        {uri:  '/optic/update/write5.xml',doc:xdmp.unquote("<doc><action>write4</action></doc>")}]
op.fromDocDescriptors(docDescriptors)
.patch(op.col('doc'),
       op.patchBuilder('/doc',null)
         .insertAfter("action",xdmp.unquote("<status>NEW</status>"))
      )
.write()
.result();
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy