
ModifyPlan.prototype.patch( docColumn as ColumnIdentifier, patchDef as Object ) as ModifyPlan
Builds a patch operation including a sequence of inserts, replaces, replace-inserts and deletes.
| Parameters | |
|---|---|
| docColumn | The document column which needs to be patched. The column can be named with a string or a column function such as op.col, op.viewCol, or op.schemaCol. |
| patchDef | The patch definition as op.patchBuilder |
patch is a method of the following class:
'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();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.