mongoDB - Introduction

MongoDB

MongoDB is No SQL document database and it is open source. Mainly mongoDB is written in C++. This is database is more performance oriented base. MongoDB works on concepts of collection and document. 

Database

 Physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases. 


Collection

This is a group of MongoDB document. This is more similar to the RDBMS table. Collection id existing within a single database. Document in mongoDB within a collection can have different field. 

Document

This is mainly set of key value pairs. Document have dynamic schema. document in the same collocation do not need to have same field or the structure.  

Why Use MongoDB?

  • No SQL data base so need to worry about the relations as SQL databases.
  • Fast in place updates
  • Index on any attribute
  • Document oriented storage - data store in the JSON document style

Where to use?

  • Data Hub
  • Mobile application and user infrastructure.
  • Big Data  

Install MongoDB on Windows

  1. Download latest release of MongoDB from this link. (https://www.mongodb.com/try)
  2. Enter required details and Select the server tab from there you can choose the mongoDB version and the package details that you wish to download.
  3. After downloading install the files all the files should be downloaded to the path of C:\Program Files\
  4. MongoDB require a folder to keep there files create a folder in this path called  c:\data\db to store this files by providing the following commands. 
                    C:\ > md data
                    C:\md data\db
      5. Then you need to specify set the dbpath to the created directory in mongod.exe. For the same, issue the following commands.
     6.  In the command prompt, navigate to the bin directory current in the MongoDB installation folder. Suppose my installation folder is C:\Program Files\MongoDB 

 C:\Users\XYZ>d:cd C:\Program Files\MongoDB\Server\4.2\bin
C:\Program Files\MongoDB\Server\4.2\bin>mongod.exe --dbpath "C:\data"  

      7. Now to run the mongoDB you have to issue following commands 

C:\Program Files\MongoDB\Server\4.2\bin>mongo.exe
MongoDB shell version v4.2.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("4260beda-f662-4cbe-9bc7-5c1f2242663c") }
MongoDB server version: 4.2.1
>

Comments