How to create database in MongoDB

Asked on September 19, 2019
How to create database in MongoDB?

Replied on September 19, 2019
1. Install MongoDB from the URL

2. Go to installation directory /MongoDB/Server/4.0/bin

3. Click on mongod.exe, server will be started.

4. Now click on mongo.exe and a command prompt will open.

5. Write command use <db_name> such as
> use myDB

Database will be created and you will be switched in that database.

6. To check your database, run command 
> db
Output will be your current database name.

Write Answer

©2024 | Privacy Policy | Contact Us