Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created July 1, 2013 10:56
Show Gist options
  • Save ableasdale/5899947 to your computer and use it in GitHub Desktop.
Save ableasdale/5899947 to your computer and use it in GitHub Desktop.
Extract a sequence of forest ids local to a given host
xquery version "1.0-ml";
declare namespace fs="http://marklogic.com/xdmp/status/forest";
declare variable $DATABASE as xs:string := "YOUR-DATABASE-HERE";
declare function local:get-host-forest-ids() as xs:unsignedLong+ {
for $f in xdmp:database-forests(xdmp:database($DATABASE))
where xdmp:forest-status($f)/fs:host-id eq xdmp:host()
return
$f
};
local:get-host-forest-ids()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment