Loading TOC...
Matches for cat:function/javascript (cat:function) have been highlighted. remove

MarkLogic Server 11.0 Product Documentation
flexrep.configurationTargetSetName

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

Summary

This function sets the name of the specified replication target.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
name The name of the target.

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.configurationTargetSetName(config, targetId, 'NewTarget');

  flexrep.configurationInsert(cfg); 

  // Changes the name of the 'Replica' target to 'NewTarget'.
      
   

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