MarkLogic 12 EA 1 Product Documentation
admin:forest-delete

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

Summary

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

Parameters
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:

http://marklogic.com/xdmp/privileges/admin/database

http://marklogic.com/xdmp/privileges/admin/database/{id}

http://marklogic.com/xdmp/privileges/admin/forest

http://marklogic.com/xdmp/privileges/admin/forest/{id}

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.

Example


  xquery version "1.0-ml";

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

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

      => 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.
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy