MarkLogic Server 11.0 Product Documentation
trgr.preCommit

trgr.preCommit() as element(trgr.when)

Summary

Returns the XML representation of a pre-commit trigger timing.

Usage Notes

Use this function with trgr.triggerDataEvent to create a pre-commit trigger event. To learn more about pre-commit triggers, see "Using Triggers to Spawn Actions" in the Application Developer's Guide.

Example

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

trgr.postCommit()
  trgr.triggerDataEvent(
    trgr.directoryScope('/myDir/', '1'),
    trgr.documentContent('create'),
    trgr.preCommit());

// A document modification trigger event that can
// be used to create a trigger which fires whenever 
// a document is created in /myDir/. The associated
// trigger module executes before committing the 
// firing document creation transaction.
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy