Loading TOC...

flexrep.configurationTargetGetId

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

Summary

This function returns the ID of the named replication target.

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

Example

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

  // 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 cfg = flexrep.configurationGet(domain, true);

  flexrep.configurationTargetGetId(cfg, 'Replica');

  // Returns the ID of the target named "Replica." :)    
   

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