Introduction To MongoDB

  • MongoDB is a one of the most popular NoSQL DataBase.
  • MongoDB is Written In C++.
  • MongoDB is a Document-Oriented NoSQL DataBase.
  • It's not store data like Tables And Row as like other relational database.
  • Documents consist of Key-Value pairs which are the basic unit of data in MongoDB.
  • MongoDB also provides the feature of Auto-Scaling.
  • MongoDB can be installed across different platforms Like Windows, Linux etc.
  • MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.
  • MongoDB has two major par JSON Objects. The values of fields may include other documents, arrays, and arrays of documents.

What Is MongoDB DataBase, Collections, Documents?

⇒ Database :

Database is a group of collections.

⇒ Collections :

Collection is a group of MongoDB documents. Collections similar like table(RDBMS) but it's not actually table because table is group of rows and columns but MongoDB documents store data as a key and value pair.

⇒ Documents :

A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure.

➤ Different Keywords RDBMS Vs MongoDB.

RDBMS : Database   MongoDB : Database

RDBMS : Table   MongoDB : Collection

RDBMS : Tuple/Row   MongoDB : Document

RDBMS : Column   MongoDB : Field

RDBMS : Table Join   MongoDB : Embedded Documents

➤ Sample Document Of Store MongoDB Data.

{
   _id: ObjectId("5ecc9ed56e381f0fb0b16f14")
   username: 'code4js', 
   aboutme: 'sample code',
   website: 'http://www.code4js.tech',
   age: 26,
   address: [	
      {
         city:'Baroda',
         state: 'Gujarat',
         country: 'India'
      }
   ]
}

Advantages of MongoDB

  • MongoDB is schema less. It is a document database in which one collection holds different documents.
  • There may be difference between number of fields, content and size of the document from one to other.
  • Structure of a single object is clear in MongoDB.
  • There are no complex joins in MongoDB.
  • MongoDB provides the facility of deep query because it supports a powerful dynamic query on documents.
  • It is very easy to scale.

Disadvantages of MongoDB

  • Data consumption is generally high due to de-normalization.
  • Joins on data are not supported.
  • There is no default transaction support; you need to handle this yourself.
  • It is not relational (then again, if you need relational, you’d use a relational solution).
  • MongoDB stores key names for each value pairs. Also, due to no functionality of joins, there is data redundancy. This results in increasing unnecessary usage of memory.
  • You can have document size, not more than 16MB.

Comments

Post a Comment