MongoDB Create Database

There is no make database common in MongoDB. Really, MongoDB don't give any order to make database.

It might be resemble a bizarre idea, on the off chance that you are from conventional SQL foundation where you have to make a database, table and embed values in the table physically.

Here, in MongoDB you don't have to make a database physically on the grounds that MongoDB will make it naturally when you spare the quality into the characterized accumulation at first time.

You additionally don't have to say what you need to make, it will be consequently made at the time you spare the quality into the characterized accumulation.

Here one thing is exceptionally astounding that you can make accumulation physically by "db.createCollection()" however not the database.

How and when to create database

In the event that there is no current database, the accompanying order is utilized to make another database.



In the event that the database as of now exists, it will give back the current database.

Let' take a sample to show how a database is made in MongoDB. In the accompanying case, we are going to make a database "javatportaldb".

See this sample

>use javatportaldb 
Swithched to db javatportaldb

Swithched to db javatportaldb

To check the at present chose database, utilize the order db:


To check the database rundown, utilize the summon show dbs:

>show dbs 
neighborhood 0.078GB

Here, your made database "javatportaldb" is not present in the rundown, embed no less than one report into it to show database: