
trgr.triggersChangeModulesDatabase( old-db as (Number|String), new-db as (Number|String) ) as null
This function changes the trigger definitions of each trigger definition in the database that has the database ID $old-db and replaces each database ID with $new-db. This is useful after restoring a triggers database to a different cluster that has different database IDs than the one from which it was backed up.
| Parameters | |
|---|---|
| old-db | The old database ID. |
| new-db | The new database ID. |
xquery version "1.0-ml";
(: run this against you triggers database :)
import module namespace trgr = "http://marklogic.com/xdmp/triggers"
at "/MarkLogic/triggers.xqy";
trgr:triggers-change-modules-database(5184170867299910410,
xdmp:database("Modules") )
=> Empty sequence. Sets all triggers that reference 5184170867299910410
as their modules database to reference the ID of the Modules database.
declareUpdate();
const trgr = require('/MarkLogic/triggers');
trgr.triggersChangeModulesDatabase(5184170867299910410,
xdmp.database('Modules'));
// Empty sequence. Sets all triggers that reference 5184170867299910410
// as their modules database to reference the ID of the Modules database.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.