trgr.triggerDataEvent( 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
.
Parameters | |
---|---|
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.
|
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.triggerDataEvent( trgr.directoryScope('/myDir/', '1'), trgr.documentContent('create'), trgr.postCommit() ); // 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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.