Loading TOC...


   $config as element(configuration),
   $forest-ids as xs:unsignedLong*,
   $delete-data as xs:boolean
) as element(configuration)


This function deletes the configuration for the specified forest from the configuration.

$config A configuration specification, typically as returned from one of the Admin module functions.
$forest-ids One or more forest ids. For example, xdmp:forest("myForest") specified the ID for a forest named "myForest".
$delete-data If set to true, deletes the data directory as well as the configuration (Note: all documents in the forest will be permanently deleted). For public forests (forests that do not use the default data directory), if set to false, deletes only the configuration information, leaving the forest data in the data directory on disk. Configuration-only deletes are available only for public forests (forests that have a data directory specified); private forests (forests that have no data directory specified and therefore are stored in the default MarkLogic data directory) will ignore this parameter and the forest data will always be deleted.

Required Privileges

This operation requires at least one of the following privileges:





Usage Notes

Any forest whose ID you pass into this function must not be attached to a database when the transaction begins, otherwise an exception is thrown. If you need to detach the forest, do so in a separate transaction before using them in this function.


  xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin"
		  at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  admin:forest-delete($config, admin:forest-get-id($config, "Documents"),

      => deletes the forest configuration for the forest
         named "Documents." Use admin:save-configuration to save the changes
         to the configuration or pass the configuration to other Admin API
         functions to make other changes.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.