How to create MongoDB database

How to create MongoDB database

In today’s topic, We will see that how to create MongoDB database.

In SQL database, you have to create database first and then you need to use “use databsaename” to access that database using shell,

But in MongoDB you can directly use below command to create and switch database.

use DATABASE_NAME

Example

Using below command you can know your current database

Below is the command to show all databases;

You are confused that I have created my database with name “myfirstmongodb” but it is not displaying in that list right,

In MongoDB you need to create atleast one document then only that database will display in above list

Hope you like my this post , Please share it with your friends and keep visiting

Leave a Reply
Your email address will not be published. *