MarkLogic 9 Product Documentation
admin:database-create

admin:database-create(
   $config as element(configuration),
   $database-name as xs:string,
   $security-db as xs:unsignedLong,
   $schema-db as xs:unsignedLong?
) 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


  xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin"
		  at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  return
  admin:database-create($config, "myNewDatabase",
            xdmp:database("Security"), xdmp:database("Schemas"))

     (: returns the new configuration element -- use admin:save-configuration
        to save the changes to the configuration or pass the configuration
        to other Admin API functions to make other changes.  :)
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy