MarkLogic Server 11.0 Product Documentation
PatchBuilderPlan.prototype.insertAfter

PatchBuilderPlan.prototype.insertAfter(
   path as String,
   content as Node
) as PatchBuilderPlan

Summary

Insert a new node after another node.

Parameters
path The path to insert the node after.
content The node to insert.

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')
         .insertAfter("action",xdmp.unquote("<status>NEW</status>"))
      )
.write()
.result();
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy