Loading TOC...

MarkLogic 9 Product Documentation
trgr:get-trigger

trgr:get-trigger(
   $trigger-name as xs:string
) as element(trgr:trigger)

Summary

Returns the XML representation of a trigger with the given name.

Parameters
trigger-name The trigger name.

Usage Notes

This function must be run in the context of the database containing the trigger to be examined. If no trigger with the name $trigger-name exists, the exception TRGR-TRIGGERDNE is raised.

Example

xquery version "1.0-ml";
import module namespace trgr="http://marklogic.com/xdmp/triggers" 
   at "/MarkLogic/triggers.xqy";

(: Run in the context of the database containing the trigger :)
trgr:get-trigger("myTrigger")

  => <trgr:trigger xmlns:trgr="http://marklogic.com/xdmp/triggers">
       <trgr:trigger-id>7561204940964272849</trgr:trigger-id>
       <trgr:trigger-name>myTrigger</trgr:trigger-name>
       <trgr:description>Simple trigger example</trgr:description>
       <trgr:data-event>
         <trgr:directory-scope>
           <trgr:uri>/myDir/</trgr:uri>
           <trgr:depth>1</trgr:depth>
         </trgr:directory-scope>
         <trgr:document-content>
           <trgr:update-kind>create</trgr:update-kind>
         </trgr:document-content>
         <trgr:when>post-commit</trgr:when>
       </trgr:data-event>
       <trgr:module>
         <trgr:database>10570023054829957732</trgr:database>
         <trgr:root>/modules/</trgr:root>
         <trgr:path>log.xqy</trgr:path>
       </trgr:module>
       <trgr:enabled>true</trgr:enabled>
       <trgr:recursive>true</trgr:recursive>
       <trgr:task-priority>normal</trgr:task-priority>
     </trgr:trigger>
 

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