Loading TOC...

trgr:directory-scope

trgr:directory-scope(
   uri as xs:string,
   depth as xs:string
) as element(trgr:directory-scope)

Summary

Returns the XML representation of a directory scope, usable as the scope parameter of a trigger event constructor such as trgr:trigger-data-event .

Parameters
uri The directory uri.
depth The depth of descendants included in the scope. ("1" or "infinity")

Example

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

trgr:trigger-data-event(
  trgr:directory-scope("/myDir/", "1"),
  trgr:document-content("modify"),
  trgr:post-commit())

  => A directory modification trigger event that may
     be used to create a trigger which fires whenever
     the /myDir/ directory in a database is modified.
  

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