Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created June 3, 2015 14:59
Show Gist options
  • Save ableasdale/7da8b16c51e3d25cf60c to your computer and use it in GitHub Desktop.
Save ableasdale/7da8b16c51e3d25cf60c to your computer and use it in GitHub Desktop.
Get a list of all databases in a support dump and their ids
xquery version "1.0-ml";
declare namespace db = "http://marklogic.com/xdmp/database";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare variable $SUPPORT-DUMP-FILEPATH as xs:string := 'E:\support-request-go\support-request-go.txt';
declare variable $support as document-node()* := xdmp:document-get(
$SUPPORT-DUMP-FILEPATH,
<options xmlns="xdmp:document-get">
<format>xml</format>
<repair>full</repair>
</options>
);
element db-listing {
for $x in $support//db:databases/db:database
return element database { attribute id { $x/db:database-id}, $x/db:database-name/text() }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment