
PatchBuilderPlan.prototype.replaceValue( path as String, content as Object ) as PatchBuilderPlan
Replace the value of a path with a new value.
| Parameters | |
|---|---|
| path | The path to replace the value. |
| content | The new value. |
'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')
.replaceValue("action","newAction")
)
.write()
.result();