
admin.databaseCreate( config as element(configuration), database-name as String, security-db as (Number|String), schema-db as (Number|String)? ) as element(configuration)
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.
	     | 
	    
http://marklogic.com/xdmp/privileges/admin/database  
  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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.