Loading TOC...


   $scope as Node,
   $content as Node,
   $when as element(trgr.when)
) as element(trgr.dataEvent)


Returns the XML representation of a triggering eventa, usable as the event parameter of trgr.createTrigger .

$scope An event scope, such as is created by trgr.directoryScope , trgr.collectionScope , or trgr.documentScope .
$content An event part, such as is created by trgr.documentContent , trgr.propertyContent , or trgr.anyPropertyContent .
$when The timing of the trigger execution (pre- or post-commit). Use trgr.postCommit or trgr.preCommit to construct this element.

Usage Notes

The scope parameter describes the set of documents to which the trigger event applies. The content parameter describes the interesting activity within scope, such as document creation or document property modification. The when parameter describes when the event should be acted on, relative to the triggering transaction.


const trgr = require('/MarkLogic/triggers');

  trgr.directoryScope('/myDir/', '1'),

// A trigger event suitable for use with trgr.createTrigger.
// The triggering event occurs at post-commit whenever a document
// is created in the database directory '/myDir/'.

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