Skip to content

Instantly share code, notes, and snippets.

@nishantsingh1
Last active April 25, 2018 06:15
Show Gist options
  • Save nishantsingh1/2acf5ff84a2d63ca9574aedad2899188 to your computer and use it in GitHub Desktop.
Save nishantsingh1/2acf5ff84a2d63ca9574aedad2899188 to your computer and use it in GitHub Desktop.
Triggers module definition
xquery version '1.0-ml';
(: evaluate this against the database specified
in the trigger definition minitrigger in this example)
:)
xdmp:document-insert("/action/trg-mini-create-action.xqy",
text{ "
xquery version '1.0-ml';
import module namespace trgr='http://marklogic.com/xdmp/triggers'
at '/MarkLogic/triggers.xqy';
import module namespace mylib='minilib' at '/SAMPLE/MODULE/sample-library.xqy';
declare variable $trgr:uri as xs:string external;
xdmp:log(fn:concat('*****Document with /mini root ', $trgr:uri, ' was created.*****', mylib:get-metadata()))"
}, xdmp:permission('app-user', 'execute'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment