MongoDB Drop Database working-Programmershelper

0
146
Spread the love

Introduction

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.

Prerequisite

You should also read my previous articles.In which I explained MongoDB update document step by step guidelines and MongoDB create a database step by step guideline

Implementation Section

  • db.dropDatabase

The following is a basic syntax-

  • <db> is a reserved word.
  • <dropdatabase> is also reserved word used for drop database.

Practical work

<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.

output:Alt Tag MongoDB Drop 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-

Output

Alt tag MongoDB drop database

Now check again a list of database.

The following command is used-

output:

The the following fig you will see <cricket database> is not showing.

Alt tag MongoDB drop database

 

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.