Loading TOC...

flexrep:apply

flexrep:apply(
   $update as element(flexrep:update),
   $content as document-node()?
) as empty-sequence()

Summary

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.

Example

  xquery version "1.0-ml"; 

  import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication" 
      at "/MarkLogic/flexrep.xqy";

  let $update :=
    <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>

    let $doc := fn:doc("/content/foo.xml")

    return flexrep:apply($update, $doc)

   (: Applies the specified update element to /content/foo.xml. :)
     

Required Privileges

http://marklogic.com/xdmp/privileges/flexrep-user

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.