Loading TOC...

admin.databaseDelete

admin.databaseDelete(
   config as element(configuration),
   database-ids as (Number|String)[]
) 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")).

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}

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

  
  const admin = require('/MarkLogic/admin.xqy');
  const config = admin.getConfiguration()
  admin.databaseDelete(config, admin.databaseGetId(config, "foo"))
  => The new configuration with the specified databases is removed.
     Use admin.saveConfiguration to save these changes.

  

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