Loading TOC...

MarkLogic Server 11.0 Product Documentation
admin.databaseCreate

admin.databaseCreate(
   config as element(configuration),
   database-name as String,
   security-db as (Number|String),
   schema-db as (Number|String)?
) as element(configuration)

Summary

This function creates a new database specification.

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
database-name The name the database to create. The name must not be used by any other database in the cluster.
security-db The ID of the security database (for example, xdmp.database("Security") used by this database.
schema-db The ID of the schemas database (for example, xdmp.database("Schemas") used by this database.

Required Privileges

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

Example

  
  const admin = require('/MarkLogic/admin.xqy');
  const config = admin.getConfiguration()
  admin.databaseCreate(config, "myNewDatabase",
            xdmp.database("Security"), xdmp.database("Schemas"))

      //returns the new configuration element -- 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.