Loading TOC...

MarkLogic Server 11.0 Product Documentation
flexrep.targetDelete

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

Summary

This function deletes a target from a replication configuration. You must use the flexrep.configurationInsert function to insert the configuration for the delete to take place. When the configuration is inserted, any additional documents created to track state for the target will be removed.

Parameters
cfg The replication configuration.
target-id The target ID.

Example

// Execute on the Master database. 
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.targetDelete(
        config,
        targetId);

  flexrep.configurationInsert(cfg);
 
  // Deletes the target, named "Replica," from the Master database.
   

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