Skip to main content

Introduction to NoSQL(MONGODB)

Mongo DB is a document oriented database. It is an open source product, developed and supported by a company named 10gen

what was the need of MongoDB although there were many databases in action?

 Relational Databases have failed in solving some of the complex modern problems like :-
  1. Continuosly changing nature of data - structured, semi-structured, unstructured and polymorphic data.
  2. Applications now serve millions of users in different geo-locations, in different timezones and have to be up and running all the time, with data integrity maintained
  3. Applications are becoming more distributed with many moving towards cloud computing.

What is Structured Data?

Structured data is usually text files, with defined column titles and data in rows. Such data can easily be visualized in form of charts and can be processed using data mining tools.

What is Unstructured Data?

Unstructured data can be anything like video file, image file, PDF, Emails etc. What does these files have in common, nothing. Structured Information can be extracted from unstructured data, but the process is time consuming. 



Need new kind of database:-

  1. Horizontal Scaling -
  2. Flexible data Model - 
  3. Faster Development 
  4. Low Upfront cost - Maintaining no sql data base is chipper than Sql database

Some Advantages of NoSQL Databases :-

  1. Highly Scalable 
  2. Provides high flexibility - 
  3. ACID properties are not needed
  4. Asynchronous inserts and updated 
  5. Handle huge amount of data
  6. Substitute the limitations of SQL

NoSQL Database Types  :-

  1. Key-Value -   These are the simplest NoSQL databases. In this each is stored with a key to identify it. In some Key-value databases, we can even save the typr of the data saved along, like in Redis.
  2. Column oriented =Used to store large data sets(store columns of data together). Example : Cassandra(Used in Facebook), HBase etc.
  3. Document -oriented =  This type, key is paired with a complex data structure called as Document. Example : MongoDB, CouchDB
  4. Graph store = This type of database is usually used to store networked data. Where in we can relate data based on some existing data eg, Neo4j
 Benefits of No SQL database :-
  1. Elasting Scaling
  2. Avoid joins
  3. No need for data to fit a schema
  4. Quick and easy development
  5. Ability to cope with network failure
  6. Low latency(time gab between input and output) is low and high performance
  7. Integrate Caching facility
  8. Dynamic Schemas

    You must be wondering what does dynamic schema means? In Relational Databases like Oracle, MySQL we define table structures, right? For example, if we want to save records of Student Data, then we will have to create a table named Student, add columns to it, like student_id, student_name etc, this is called defined schema, where in we define the structure before saving any data.

    If in future we plan to add some more related data in our Student table, then we will have to add a new column to our table. Which is easy, if we have less data in our tables, but what if we have millions of records. Migration to the updated schema would be a hectic job. NoSQL databases solve this problem, as in a NoSQL database, schema definition is not required.

    Sharding

    In Sharding, large databases are partitioned into small, faster and easily manageable databases.
    The (classic) Relational Databases follow a vertical architecture where in a single server holds the data, as all the data is related. Relational Databases does not provide Sharding feature by default, to achieve this a lot of efforts has to be put in, because transactional integrity(Inserting/Updating data in transactions), Multiple table JOINS etc cannot be easily achieved in distributed architecture in case of Relational Databases.
    NoSQL Databases have the Sharding feature as default. No additional efforts required. They automatically spread the data across servers, fetch the data in the fastest time from the server which is free, while maintaining the integrity of data.  Horizontal Scalability is possible due to sharding.

    Replication

    Auto data replication is also supported in NoSQL databases by default. Hence, if one DB server goes down, data is restored using its copy created on another server in network.

    Integrated Caching

    Many NoSQL databases have support for Integrated Caching, where in the frequently demanded data is stored in cache to make the queries fater.



     

Comments

Popular posts from this blog

OOPs Concept For Automation

The java.util package contains all the classes and interfaces of Collection Framework.   Two Main root interfaces : Collection & Map  Parent Interface of Collection is Interable Iterable Interface  : -The Iterable interface is the root interface for all the collection classes and all the collection class implement the Iterable interface. Iterator< T > iterator(); Iterator interface provides the facility of iterating the elements in a forward direction only. // Returns true if the iteration has more elements public boolean hasNext(); // Returns the next element in the iteration // It throws NoSuchElementException if no more  // element present public Object next(); // Remove the next element in the iteration // This method can be called only once per call // to next() public void remove(); interface Collection< E > extends Iterable< E > interface Map< K , V > Collection : Root int...