...

Database Managment - Mongo DB

Back to Course

Lesson Description


Lession - #1403 MongoDb Drop Databse


MongoDB - Drop Database

The dropDatabase(>
Method
MongoDB db.dropDatabase(>
order is utilized to drop a current information base. Language structure Fundamental linguistic structure of dropDatabase(>
order is as per the following −

db.dropDatabase(>

This will erase the chose data set. On the off chance that you have not chosen any data set, then it will erase default 'test' information base.
Example: In the first place, really look at the rundown of accessible information bases by utilizing the order, show dbs.

>show dbs
local      0.78125GB
mydb       0.23012GB
test       0.23012GB
>

If you have any desire to erase new data set , then, at that point, dropDatabase(>
order would be as per the following −

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

Now check list of databases.

>show dbs
local      0.78125GB
test       0.23012GB
>