Loading TOC...


   domain-id as (Number|String),
   target-id as (Number|String),
   forest-id as (Number|String),
   max-spawn as (Number|String)
) as null


Push a batch of documents from a single forest to a single target, and respawn a new task to do this repeatedly until either nothing remains to replicate or the spawn limit is reached. Typically deployments do not need to call this directly, and instead rely on the push-local-forests.xqy scheduled task.

domain-id The domain ID.
target-id The target ID.
forest-id The forest ID.
max-spawn The maximum number of times to respawn.


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

    const domain = xdmp.eval(
    'const dom = require("/MarkLogic/cpf/domains");' +
      'fn.data(dom.get("Default Master").xpath("//dom:domain-id"));',
          'database' : xdmp.database('Triggers')

   const cfg = flexrep.configurationGet(domain, true);
   const targetId = flexrep.configurationTargetGetId(cfg, 'Replica');
   const domainId = flexrep.configurationGetId(cfg);
   const forestId =  
      admin.forestGetId(admin.getConfiguration(), "Master-forest");

flexrep.pushLocalForestTarget(domainId, targetId, forestId, 10);

Required Privileges


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