MarkLogic 9 Product Documentation
admin.forestDelete

admin.forestDelete(
   config as element(configuration),
   forest-ids as (Number|String)[],
   delete-data as 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

  
  const admin = require('/MarkLogic/admin.xqy');
  var config = admin.getConfiguration()
  admin.forestDelete(config, admin.forestGetId(config, "Documents"),
      fn.false())
      => deletes the forest configuration for the forest
         named "Documents." Use admin.saveConfiguration 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