Skip to content

Latest commit

 

History

History
68 lines (41 loc) · 2.66 KB

create-delete-database.java.markdown

File metadata and controls

68 lines (41 loc) · 2.66 KB

Commands: How to create or delete database?

This article will describe the following commands that enable you to manage databases on a server:

{PANEL:CreateDatabase}

This method is used to create a new database on a server.

Syntax

{CODE:java create_database_1@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

Parameters
databaseDocument DatabaseDocument A document containing all configuration options for new database (e.g. active bundles, name/id, path to data)

Example

{CODE:java create_database_2@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

{PANEL/}

{PANEL:DeleteDatabase}

This method is used to delete a database from a server, with a possibility to remove all the data from hard drive.

Syntax

{CODE:java delete_database_1@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

Parameters
dbName String Name of a database to delete
hardDelete bool Should all data be removed (data files, indexing files, etc.). Default: false

Example

{CODE:java delete_database_2@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

{PANEL/}

{PANEL:EnsureDatabaseExists}

This extension method creates database on a server with default configuration and indexes if that database does not exist.

Syntax

{CODE:java ensure_database_exists_1@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

Parameters
name String Name of a database that will be created if it does not exist
ignoreFailures boolean Ignore any exceptions that could have occurred during database creation. Default: false

Example

{CODE:java ensure_database_exists_3@ClientApi\Commands\HowTo\CreateDeleteDatabase.java /}

{PANEL/}

Related articles