HowToDoInJava

  • Python
  • Java
  • Spring Boot
  • Dark Mode
Home / MongoDB / Introduction to MongoDB: Why MongoDB?

Introduction to MongoDB: Why MongoDB?

Before jumping directly into basics of MongoDB, we should try to understand the need to No-SQL database itself. Why the traditional relational databases are loosing the battle with their new competitor like MongoDB. Why they are so popular now-a-days. Why?

Why NoSQL?

Interactive applications have changed dramatically over the last 15 years, and so have the data management needs of those apps. Data is becoming easier to capture and access through third parties such as Facebook, D&B, and others. Personal user information, geo location data, social graphs, user-generated content, machine logging data, and sensor-generated data are just a few examples of the ever-expanding array of data being captured. And the use of the data is rapidly changing the nature of communication, shopping, advertising, entertainment, and relationship management. Apps that don’t leverage it quickly will quickly fall behind.

Developers want a very flexible database that easily accommodates new data types and isn’t disrupted by content structure changes from third-party data providers. Much of the new data is unstructured and semi-structured, so developers also need a database that is capable of efficiently storing it. Unfortunately, the rigidly defined, schema-based approach used by relational databases makes it impossible to quickly incorporate new types of data, and is a poor fit for unstructured and semi-structured data. NoSQL provides a data model that maps better to these needs.

Why MongoDB?

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling across a configurable set of systems that function as storage nodes.


MongoDB shines because of its ease of use, whether a developer is using it in a large-scale application that spans hundreds or thousands of nodes, or in a single-server application that has no need for scale.

If you remember that in JSON we store the information in key-value pairs like this:

{
   name : "lorem",
   address : "ipsum
}

MongoDB stores all data in documents, which are JSON-style data structures composed of field-and-value pairs. MongoDB stores documents on disk in the BSON serialization format. BSON is a binary representation of JSON documents, though it contains more data types than JSON. These documents can be simple documents as above and can also be complex documents such as below:

{
    id: x,
    name: y,
    other: z,
    multipleArray: [
        {lab1: "A",  lab2: "B", lab3:"C"},
        {lab1: "AB", lab2: "BB", lab3:"CB"},
        {lab1: "AC", lab2: "BC", lab3:"CC"}
    ]
}

Most user-accessible data structures in MongoDB are documents, including:

-> All database records.
-> Query selectors, which define what records to select for read, update, and delete operations.
-> Update definitions, which define what fields to modify during an update.
-> Index specifications, which define what fields to index.
-> Data output by MongoDB for reporting and configuration, such as the output of the server-status and the replica set configuration document.

Please note that there are some limitations of MongoDB as well when comparing to relational databases:

a) It doesn’t support Joins
b) It doesn’t support Transactions

That’s all for this little introductory post. These are hundreds of concepts which we will learn when we start learning MongoDB.

Happy Learning !!

References:

https://www.mongodb.com/leading-nosql-database
https://docs.mongodb.com/manual/introduction/

Was this post helpful?

Let us know if you liked the post. That’s the only way we can improve.
TwitterFacebookLinkedInRedditPocket

About Lokesh Gupta

A family guy with fun loving nature. Love computers, programming and solving everyday problems. Find me on Facebook and Twitter.

Feedback, Discussion and Comments

  1. Akmal Chaudhri

    July 3, 2015

    I have been tracking NoSQL databases for several years, collecting public data on skills and vendors. These are also important issues when considering a technology. Summary of data in section 2: https://speakerdeck.com/abchaudhri/considerations-for-using-nosql-technology-on-your-next-it-project-1

  2. Vijay

    May 26, 2014

    Can you let me the unique features Cassandra & Mongo DB and which one well suited in which cases? Also drawbacks of them.

    • Lokesh Gupta

      May 26, 2014

      Hey Vijay, As i mentioned I have started learning these technologies. I will surely reply you on this when I have better understanding.

Comments are closed on this article!

Search Tutorials

MongoDB Tutorial

  • MongoDB – Introduction
  • MongoDB – Installation
  • MongoDB – Get/Save Image GridFS
  • MongoDB – Insert Document
  • MongoDB – Query Document

Meta Links

  • About Me
  • Contact Us
  • Privacy policy
  • Advertise
  • Guest and Sponsored Posts

Recommended Reading

  • 10 Life Lessons
  • Secure Hash Algorithms
  • How Web Servers work?
  • How Java I/O Works Internally?
  • Best Way to Learn Java
  • Java Best Practices Guide
  • Microservices Tutorial
  • REST API Tutorial
  • How to Start New Blog

Copyright © 2020 · HowToDoInjava.com · All Rights Reserved. | Sitemap

  • Sealed Classes and Interfaces