Loading TOC...

admin:database-delete

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

Summary

This function deletes the configuration from the specified database(s). It does not delete the configuration or data for any forests attached to the deleted database(s).

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
database-ids The id(s) for the specified database(s) (for example, xdmp:database("myDatabase")).

Usage Notes

Any database whose ID you pass into this function must not have any appservers targeting it when the transaction begins, otherwise an exception is thrown. If you need to delete the database, make sure no appserver targets the database in a separate transaction before calling 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:database-delete($config, admin:database-get-id($config, "foo"))

  => The new configuration with the specified databases is removed.
     Use admin:save-configuration to save these changes. 
  

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