NoSQL Concept and MongoDB
Join the DZone community and get the full member experience.
Join For Freein 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-based , key/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/
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/
Opinions expressed by DZone contributors are their own.
Trending
-
Clear Details on Java Collection ‘Clear()’ API
-
What Is JHipster?
-
Comparing Cloud Hosting vs. Self Hosting
-
Introduction To Git
Comments