admin.databaseCopy( 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.
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. |
http://marklogic.com/xdmp/privileges/admin/database
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.