Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Last active May 26, 2016 16:15
Show Gist options
  • Save ableasdale/683952f6ca5cdb86a5f049debbb4936e to your computer and use it in GitHub Desktop.
Save ableasdale/683952f6ca5cdb86a5f049debbb4936e to your computer and use it in GitHub Desktop.
Reorder forests and save the configuration back to MarkLogic
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $dbid := admin:database-get-id($config, "test-db")
let $forests := admin:database-get-attached-forests($config,$dbid)
let $config := admin:database-reorder-forests($config, $dbid, ( (Forest1, Forest2,.. ))
(:replace above with the correct forest ordering :)
return admin:save-configuration($config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment