Loading TOC...


   config as element(configuration),
   database-id as (Number|String),
   database-name as String
) as element(configuration)


This function creates a new database specification with the same settings as the database with the specified ID. The new database configuration will have the specified name.

config A configuration specification, typically as returned from one of the Admin module functions.
database-id The ID of the database to copy (for example, xdmp.database("myDatabase")).
database-name The name of the new database to create.

Required Privileges



  const admin = require('/MarkLogic/admin.xqy');
  const config = admin.getConfiguration()
  admin.databaseCopy(config, xdmp.database("myOldDatabase"),
   => Creates a configuration with a new database specification
      having the same settings as the database named "myOldDatabase".
      Use admin.saveConfiguration 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.