
flexrep.apply( update as element(flexrep.update), content as Node? ) as null
This function applies an update element to the current database.
| Parameters | |
|---|---|
| update | The update element to apply to the database. |
| content | The updated document node. |
// Applies the specified update element to /content/foo.xml.
const flexrep = require('/MarkLogic/flexrep');
declareUpdate();
let update =
fn.head(xdmp.unquote(
'<flexrep:update xmlns:flexrep="http://marklogic.com/xdmp/flexible-replication">' +
'<doc:uri xmlns:doc="xdmp:document-load">/content/foo.xml</doc:uri>' +
'<flexrep:last-updated>2010-03-04T14:30:16.56-08:00</flexrep:last-updated>' +
'<doc:format xmlns:doc="xdmp:document-load">xml</doc:format>' +
'<doc:permissions xmlns:doc="xdmp:document-load"/>' +
'<doc:collections xmlns:doc="xdmp:document-load"/>' +
'<doc:document-quality xmlns:doc="xdmp:document-load">0</doc:document-quality>' +
'<prop:properties xmlns:prop="http://marklogic.com/xdmp/property"/>' +
'</flexrep:update>')).root;
let doc = fn.doc("/content/foo.xml");
flexrep.apply(update, doc);
http://marklogic.com/xdmp/privileges/flexrep-user