Database

MongoDB is one of the most popular NoSQL databases around. The popularity of NoSQL databases boomed with the MEAN and MERN.

Creating a database is really simple especially in MongoDB.

use your_database_name
switched to db your_database_name

It is really that simple. There is one bit of a problem here. When you use the show dbs command, you won’t see any new databases. This is because the new database doesn’t have any collection yet.

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

Let’s create our collection

> db.createCollection('books')
{ "ok" : 1 }
> show dbs
admin               0.000GB
config              0.000GB
local               0.000GB
your_database_name  0.000GB

Now that’s how to create your database in MongoDB.