Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created July 2, 2017 15:54
Show Gist options
  • Save ableasdale/1623c4f1b2d29afca099afe4dd134f02 to your computer and use it in GitHub Desktop.
Save ableasdale/1623c4f1b2d29afca099afe4dd134f02 to your computer and use it in GitHub Desktop.
MarkLogic: Simple Forest Creation
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare variable $PATH as xs:string := "/tmp";
declare variable $NUMBER-OF-FORESTS as xs:integer := 4;
declare variable $FOREST-NAME as xs:string := "example-forest";
declare variable $CONFIG := admin:get-configuration();
for $i in 1 to $NUMBER-OF-FORESTS
let $CONFIG := admin:forest-create($CONFIG, $FOREST-NAME||"-"||$i, xdmp:host(), $PATH)
return admin:save-configuration($CONFIG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment