Loading TOC...

admin.databaseCopy

admin.databaseCopy(
   $config as element(configuration),
   $database-id as (Number|String),
   $database-name as String
) as element(configuration)

Summary

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.

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

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

Example

  
  const admin = require('/MarkLogic/admin.xqy');
  var config = admin.getConfiguration()
  admin.databaseCopy(config, xdmp.database("myOldDatabase"),
                    "myNewDatabase")
   => 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.