What is MongoDB

                   MongoDB - Document Oriented NoSQL DataBase:

MongoDB is one of several database types to arise in the mid-2000s under the NoSQL banner. Instead of using tables and rows as in relational databases, MongoDB is built on an architecture of collections and documents. Documents comprise sets of key-value pairs and are the basic unit of data in MongoDB. Collections contain sets of documents and function as the equivalent of relational database tables.

Like other NoSQL databases, MongoDB supports dynamic schema design, allowing the documents in a collection to have different fields and structures. The database uses a document storage and data interchange format called BSON, which provides a binary representation of JSON-like documents. Automatic sharding enables data in a collection to be distributed across multiple systems for horizontal scalability as data volumes increase and Replication allows to replicate data on multiple machine for fault-tolrance.


MongoDB is great for modeling many of the entities that back most modern web-apps, either consumer or enterprise:
  • Account and user profiles: can store arrays of addresses with ease
  • CMS: the flexible schema of MongoDB is great for heterogeneous collections of content types
  • Form data: MongoDB makes it easy to evolve the structure of form data over time
  • Blogs / user-generated content: can keep data with complex relationships together in one object
  • Messaging: vary message meta-data easily per message or message type without needing to maintain separate collections or schemas
  • System configuration: just a nice object graph of configuration values, which is very natural in MongoDB
  • Log data of any kind: structured log data is the future
  • Graphs: just objects and pointers – a perfect fit
  • Location based data: MongoDB understands geo-spatial coordinates and natively supports geo-spatial indexing

MongoDB Instalation:

Installation of MongoDB is very easy we can install on linux,windows,mac etc.
 (i will write for both linux and windows respectively)

Step1. Create data directory:
mkdir /data/mdb
or
mkdir C:\data\mdb

Step2. Start mongodb server using mongod file

/home/user/mongodb/bin/mongod --dbpath /data/mdb
or
C:\mongodb\bin\mongod.exe  --dbpath C:\data\mdb

(it will start on localhost bydefault and default port will be 27017)
 we can change port number before starting like:

/home/user/mongodb/bin/mongod --dbpath /data/mdb --port 10000
or
C:\mongodb\bin\mongod.exe  --dbpath C:\data\mdb --port 10000

 Now server is running

We can connect it by using mongo client:

/home/user/mongodb/bin/mongo
or 
C:\mongodb\bin\mongod.exe

>show dbs
>
 

 

Comments

Post a Comment

Popular posts from this blog

Setup Nginx as a Reverse Proxy for Thingsboard running on different port/server

How to auto re-launch a YARN Application Master on a failure.

Read JSON File in Cassandra