What is meant by NoSQL?
It’s a broad term that means different things to different people. I may use it very broadly
to mean a system that plays a part in the storage of data. Put another way, NoSQL is the belief that your persistence layer isn’t necessarily the responsibility of a single system. Where relational database vendors have historically tried to position their software asa one-size-fits-all solution, NoSQL leans towards smaller units of responsibility where the best tool for a given job can be leveraged.
So, your NoSQL stack might still leverage a relational databases, say MySQL, but it’ll also contain Redis as a persistence lookup for specific parts of the system as well as Hadoop for your intensive data processing. Put simply, NoSQL is about being open and aware of alternative, existing and additional patterns and tools for managing your data.
Why NoSQL ?
The reason of occurrence of this concept and therefore, databases enhanced by this alternative approach is to meet the required speed to read/write for the data on internet that its size increases day after day and the systems with high traffic.
There are fundamental differences between the horizontally scalable NoSQL systems and relational database management systems.
- Relational database management systems are transaction-based and have ACID rules. NoSQL systems do not fully support the ACID rules and there is no transaction concept in many NoSQL systems.
- Data in the relational database management systems is located on fixed tables and columns. NoSQL systems are not dependent on fixed tables and columns.
- SQL query is not used in NoSQL systems.
- Disintegration of data by primary key is not compulsory in relational database management systems. NoSQL systems access the data over primary keys.
As we mentioned the differences in proportion to relational database management systems, I want to indicate that NoSQL systems are defined in 3 groups among themselves such as document-based, key/value based and graph-based generally and each group have differences about data consistency and data access strategies.
Today, there are so many NoSQL solutions on the market. MongoDB, which was started to be improved in 2007 by 10gen Company and has been converted to an open source project with AGPL license in 2009, is one of the most popular one among these solutions.
MongoDB presents itself as an open source designed for improvement and scaling ease and a document-oriented database. Each record is actually a document in MongoDB. Documents are stored in a JSON-like format, Binary JSON(BSN) in MongoDB. BSON documents are the objects that contain an ordered list of saved elements. Each element is composed of a field name and a specific type of value.
At this point, it would be useful to look at the mapping chart of MongoDB concepts and SQL concepts in the conventional relational database management systems:
|row||document or BSON document|
|table joins||embedded documents and linking|
Specify any unique column or column combination as primary key.
In MongoDB, the primary key is automatically set to the _id field.
|aggregation (e.g. group by)||aggregation framework
See the SQL to Aggregation Framework Mapping Chart.
MongoDB has important positive features that highlights and distinguishes itself from any other NoSQL solutions. The following features can be considered as first and foremost:
- Query Support. Whereas many NoSQL solutions enables you to access the data only through the keys, MongoDB offers to query regarding the intended fields and specific ranges (range query), also it offers you to query with regular expressions.
- Secondary Index Support. As well as the querying with respect to intended fields, defining these fields as secondary index provides to access data in a high performance.
- Master-Slave Replication Support. Directing the read and write operations to separate servers, running a slave server as a master server when the master service is inaccessible is a very important positive value undoubtedly.
- Sharding Support. Spreading the large-scaled data across multiple servers is a feature that makes different MongoDB among its kinds.
- MapReduce Support.
- Driver Support for many Software Languages.