What is MongoDB - A quick introduction to database

You are here : Home / MongoDB Tutorial


Contents of page >


1) What is MongoDB?
MongoDB is a open-source document database.
MongoDB is NoSQL database.
MongoDB is written in C++.
MongoDB is widely used these days in huge applications.


2) Advantages of using MongoDB >
MongoDB provides very high performance because it allows very quick access to data because it uses internal memory for storing the working set.
MongoDB is easy scalable.
MongoDb is tunable.
MongoDb is easily available.
MongoDb can be used as a Data Hub.
MongoDb  allows easy indexing
MongoDb allows Auto-sharding.
MongoDb can be used to store huge data.
MongoDb can be used for user Data Management.


3) What are difference in terminology in MongoDB and RDBMS >
MongoDB
RDBMS
database
database
Collection
Table
Document (or BSON document)
Row
Field (each document can have different fields)
Column (each rows cannot have different columns)
Embedded documents
Join in table
_id is the default Primary Key (which is generated automatically whenever document is inserted)
Primary Key
aggregation (e.g. group by)
aggregation pipeline


4) Terminology which are same in MongoDB and RDBMS >
MongoDB
RDBMS
database
database
index
index

1 - Many Relationship in MongoDB - One to Many

Many - 1 relationship in MongoDB - Many to One

Many-Many relationship in MongoDB



5) What is Database in MongoDB?
One MongoDB server can have multiple databases.
Each database has its own collections.


6) What are collection in MongoDB?
Collection in MongoDB is same as table in RDBMS.
Each collection has its own documents.


7) What is Document in MongoDb?
Document in MongoDB is same as row in RDBMS.
Document is set of key-value pairs in collection in MongoDB.
Each document have its own fields.


See below example of documents.
8) What is field in MongoDb?
Field in MongoDB is same as column in RDBMS.
Each document have its own fields.
Important and really interesting thing to note about document in collection is that each document can have different fields.
In RDBMS each table has its own rows but rows cannot have different columns.
See below example of fields.
9) Example of collection, document and fields>


> db.employeeTable.insert({id : 1,  firstName:"ankit"})
> db.employeeTable.insert({id : 2})
Above line will create table (or collection) (if table already exists it will insert documents in it).


> db.employeeTable.find();
Now, query collection.


Result >
Important and really interesting thing to note about documents in collection is that each document have different fields.
Document 1 has three fields.
Document 2 has two fields.


SUMMARY>
So in this mongoDB tutorial we learned
MongoDB is NoSQL database and is widely used these days in huge applications.
MongoDB provides very high performance .
Important difference in terminology in MongoDB and RDBMS >
MongoDB
RDBMS
Collection
Table
Document
Row
Field
Column
_id is Primary Key
Primary Key


Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


RELATED LINKS>

Labels: MongoDB
eEdit
Must read for you :