
admin.forestSetForeignMaster( config as element(configuration), forest-id as (Number|String), foreign-master as element(as.foreignMaster) ) as element(configuration)
This function writes the specified foreign master forest configuration into the database replication configuration. Any forest-level configuration will override the database level-configuration. This function must be executed on the replica cluster.
http://marklogic.com/xdmp/privileges/admin/database
http://marklogic.com/xdmp/privileges/admin/database/{id}
http://marklogic.com/xdmp/privileges/admin/database/replication
http://marklogic.com/xdmp/privileges/admin/database/replication/{id}
  
  const admin = require('/MarkLogic/admin.xqy');
  const cfg = admin.getConfiguration()
  const fcl = admin.clusterGetForeignClusterId(cfg, "ClusterA")
  const fdb = admin.databaseForeignMasterGetDatabaseId(
                   admin.databaseGetForeignMaster(cfg, xdmp.database("Documents")))
  const fforest = admin.forestForeignMaster(fcl, fdb , 3017132713745743620)
  admin.forestSetForeignMaster(cfg, xdmp.forest("Documents"), fforest)
   //Sets the configuration for the specified foreign master forest.//Use
   //admin.saveConfiguration to save the changes to the configuration or
   //pass the configuration to other Admin API functions to make other changes. 
    
  
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.