Tuesday 6 July 2021

ArangoDB: Drop a database

'db._dropDatabase(name)' statement is used to drop a database. You can drop the database only within the _system database, but _system database can't be deleted.

 

Step 1: Login to arango shell.

$arangosh
Please specify a password: 

                                       _     
  __ _ _ __ __ _ _ __   __ _  ___  ___| |__  
 / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ 
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
 \__,_|_|  \__,_|_| |_|\__, |\___/|___/_| |_|
                       |___/                 

arangosh (ArangoDB 3.7.11 [darwin] 64bit, using build , VPack 0.1.33, RocksDB 6.8.0, ICU 64.2, V8 7.9.317, OpenSSL 1.1.1k  25 Mar 2021)
Copyright (c) ArangoDB GmbH

Command-line history will be persisted when the shell is exited. You can use `--console.history false` to turn this off
Connected to ArangoDB 'http+tcp://127.0.0.1:8529, version: 3.7.11 [SINGLE, server], database: '_system', username: 'root'

Type 'tutorial' for a tutorial or 'help' to see common examples
127.0.0.1:8529@_system>

 

Step 2: List all the databases.

127.0.0.1:8529@_system> db._databases()
[ 
  "_system", 
  "demodb", 
  "example" 
]

 

Step 3: Drop the database demodb.

127.0.0.1:8529@_system> db._dropDatabase ("demodb")

Dropping a database is an asynchronous operation. Database is physically removed once all clients are disconnected and references have been garbage-collected.


 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment