Today, we will explore how we can create and drop databases in MongoDB. By default, 32-bit windows MongoDB comes with a two database named "local" and "Test".
To see the list of all databases in MongoDB we can use show dbs command.
show dbs
To create a new database in MongoDB we need to issue use statement.
use Database_Name
use Employee
This will create a new database with the name Employee.
If databases already exist than use command will let MongoDB to switch over to that database.
To drop or delete a database in MongoDB we will issue following syntax
use database_name
db.dropDatabase()
To drop Employee database we need to issue following command.
Use Employee
db.dropDatabase()
To see what the current database you are working with, we can issue following command
db