In this article, we learn MongoDB Drop database.My main focus describes its simple steps. Drop database statement<db.dropDatabase()> is used to remove existing database.If you want to drop a database be careful.In the case of drop database, all the necessary information will be lost.
The following is a basic syntax-
- <db> is a reserved word.
- <dropdatabase> is also reserved word used for drop database.
<dropdatabase>statment will remove the selected database. if we not selected any database by default<Test> database will be deleted.
First, we will use command name<show db> and check the existing database.
These are many existing databases that I created. I selected any one and drop a database.SO I selected<cricket> and drop that one.
The following query is used to drop a database-
> use cricket
> switched to db cricket
Now check again a list of database.
The following command is used-
The the following fig you will see <cricket database> is not showing.
I wish I could tell you that a great site of MongoDB.you just understands key element above post-MongoDB Drop database.You also read my previous lecture.I hope you will understand this lecture.Thank you for reading this lecture. Hope you got the idea. please share it.