1. Home
  2. MongoDB Tutorial
  3. MongoDB Create Database

MongoDB Create Database

There is nothing to create database command in MongoDB. MongoDB doesn’t provide any power to create a database. It might resemble a bizarre idea if you are from conventional SQL foundation where you need to create a database, table and addition values in the table physically.

Here, in MongoDB, you do not need to create a database physically because MongoDB will create it naturally when you save the value into the defined collection from the outset time.
You additionally don’t need to refer to what you need to create; it will be naturally created at the moment you save the value into the specified collection.

How and when to create a database If there is no existing database, the accompanying command is utilized to create another database.



If the database as of now exists, it will restore the existing database.

Let’ take a guide to exhibit how a database is created in MongoDB. In the accompanying model, we will create a database “FOSS”.

See this model


>use Employee


Switched to DB Employee

We have selected database, insert atleast one document.

>db.EMP-01.insert({name : "FOSS" })

List/Show Databases:

To List databases in MongoDB use below command,

>show dbs


>show dbs

local 0.4352GB

test 0.1265GB

Employee 0.2431GB



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.