Loading TOC...

MarkLogic Server 11.0 Product Documentation
flexrep:configuration-target-set-filter-options

flexrep:configuration-target-set-filter-options(
   $cfg as element(flexrep:configuration),
   $target-id as xs:unsignedLong,
   $val as element(flexrep:filter-options)
) as element(flexrep:configuration)

Summary

This function sets the specified filter options for this replication configuration. The options specified in the $val parameter are passed to the xdmp:invoke of the filter module, so any of the options you would specify in the xdmp:eval function are recognized.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
val Options to apply when invoking an outbound filter module. Specify the options as an XML element named filter-options in the "flexrep" namespace. The options element can contain any of the options from xdmp:invoke . The option child elements from xdmp:invoke must be in the "xdmp:eval" namespace.

Example

  xquery version "1.0-ml"; 

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

  (: Obtain the domain ID from the database used by the Master to enable CPF. :)
  let $domain:= xdmp:eval(
        'xquery version "1.0-ml";
         import module namespace dom = "http://marklogic.com/cpf/domains" 
	   at "/MarkLogic/cpf/domains.xqy";
         fn:data(dom:get( "Default Master" )//dom:domain-id)',
         (),
         <options xmlns="xdmp:eval">
            <database>{xdmp:database("Triggers")}</database>
         </options>)

  let $cfg := flexrep:configuration-get($domain, fn:true())      
  let $target-id := flexrep:configuration-target-get-id($cfg, "Replica")

  let $filter-opts := 
     <flexrep:filter-options>
       <user-id xmlns="xdmp:eval">{xdmp:user("John")}</user-id>
     </flexrep:filter-options>

  let $cfg := 
    flexrep:configuration-target-set-filter-options(
       $cfg, 
       $target-id, 
       $filter-opts)

  return flexrep:configuration-insert($cfg) 
  
  (: Sets the filter user to "John". :)
   

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