NoSQL Zone is brought to you in partnership with:

Altuğ has posted 7 posts at DZone. You can read more from them at their website. View Full User Profile

NoSQL Concept and MongoDB

06.25.2013
| 9841 views |
  • submit to reddit

In recent years, we often hear the name of NoSQL as a new star that is rising in the world of IT and it has emerged as a different and alternative approach compared to relational database management systems (RDBMS).

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-basedkey/value based and graphic-based generally and each group have differences about data consistency and data access strategies.

MongoDB

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:

SQL  MongoDB 
database database
table collection
row document or BSON document
column field
index index
table joins embedded documents and linking
primary key
Specify any unique column or column combination as primary key.
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.

http://docs.mongodb.org/manual/reference/sql-comparison/

mongodb

Why MongoDB?

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.

Update version number of MongoDB is 2.4.1. You can download is freely from this address: http://www.mongodb.org/downloads There is also a commercial version of MongoDB.

MongoDB documentation provides sufficient information about how to set up MongoDB on the platform you are using. All being well, we will consider how to perform CRUD operations and query processing on MongoDB in the next article.

Real content above, can be accessed at http://en.kodcu.com/2013/06/nosql-concept-and-mongodb/

Published at DZone with permission of its author, Altuğ Altıntaş.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)