Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Drop Database


The dropDatabase command is used to drop a database. It also deletes the associated data files. It operates on the current database.

Syntax:

  1. db.dropDatabase()

This syntax will delete the selected database. In the case you have not selected any database, it will delete default “test” database.

To check the database list, use the command show dbs:

  1. >show dbs
Kreationnextdb 0.078GB
local 0.078GB

If you want to delete the database “Kreationnextdb”, use the dropDatabase() command as follows:

  1. >use Kreationnextdb
switched to the db Kreationnextdb
  1. >db.dropDatabase()
{ "dropped": "Kreationnextdb", "ok": 1}

Now check the list of databases:

  1. >show dbs
local 0.078GB

Comments

comments