Loading TOC...

MarkLogic Server 11.0 Product Documentation
flexrep.configurationTargetSetFilterModule

flexrep.configurationTargetSetFilterModule(
   cfg as element(flexrep.configuration),
   target-id as (Number|String),
   uri as String
) as element(flexrep.configuration)

Summary

This function sets the specified filter for this replication configuration.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
uri The URI for the filter module.

Example

const flexrep = require('/MarkLogic/flexrep');

  declareUpdate();
  // Obtain the domain ID from the database used by the Master to enable CPF.
  const domain = xdmp.eval(
    'const dom = require("/MarkLogic/cpf/domains");' +
      'fn.data(dom.get("Default Master").xpath("//dom:domain-id"));',
       null,
         {
          'database' : xdmp.database('Triggers')
         });

  const config = flexrep.configurationGet(domain, true);
  const targetId = flexrep.configurationTargetGetId(config, 'Replica');

  const cfg = 
      flexrep.configurationTargetSetFilterModule(config, targetId, 'test.json');

  flexrep.configurationInsert(cfg);
 
  // Resets the filter module used by the target to 'test.json.'
   

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