Getting Started with Create Database in MongoDB

0
1019

Introduction

In this article. My main focus to provides a simple guideline.How to create a database in MongoDB.In MongoDB database is dynamically created. Means there is no predefined structure as compared SQL.<USE> is used to create a database in MongoDB.

Prerequisite

It would be better if you have the basic knowledge of RDBMS concept. Actually, you are going to learn a high-performance database so we need some basics of these. It will good to cover my below articles before this. It helps to learn more about MongoDB.In which I explained. Click here MongoDB Indexing working and Installation MongoDB on Windows for Beginners and Introduction of MongoDB.

Basic Syntax

 1 Step
 USE COMMAND 
If Database does not exist then USE command help to a create a new database.

The following is the syntax

Write<USE_COMMAND>then Write<Database_NAME>For example, the Database name is <LOG> then the syntax is<USE LOG>

A database has created that show in below fig.

Alt tag MongoDB database creation

But one thing more. You have basic Knowledge database. A database is a collection of a logically related data set in which program data is stored.

 2 Step

 db Command

After that, you will use command <db>which helps to show your database. That has currently created. I will show you a simple picture. That describes its working.

 

Alt tag MongoDB Database creation

Step 3

Show <dbs> Command

If you want to check your all database. You will write <Show dbs>this Command helps to show you all database that had already existing or currently created. below picture, you will see.

Alt tag MongoDB Database creation

One thing more if you create a database its mandatory to insert data into it. if not insert data into it then the database will not show. you will see above fig <logs> database does not show. because the reason behind is that, data is not inserted in a<logs> database.

Conclusion

I wish I could tell you that a great site of MongoDB.you just understands the key element above post-MongoDB database creation. more, detail about MongoDB database creation, please click here.how to create a database in MongoDB.You also read my previous lecture. I hope you will understand this lecture. Thank you for reading this lecture. Hope you got the idea.