According to wiki MongoDB (from "humongous") is a cross-platform document-oriented database system. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.
In this article we will know about Mongo DB(one of the most popular and fastest growing no sql databases)
Databases are important of every internet and enterprise applications
For scale speed and fast application development has brought on a new breed of databases broadly turned to no sql databases
The objective of this article series is to know about what no sql means versus relational databases..we will get the mongo server up and running we will know how to connect to database manipulate some data save & update and we will see how to use indexing to speed up the query time and review some indexing strategies...and some miscellaneous points along the series..
Mongo DB Vs RDBMS
As developers we wannna database that is easy to use.Relational databases save data in tables and rows..our application hardly ever does,this means alignment of application layer objects to tables and rows is called impedance mismatch as shown below...
In the above example we can notice that it has a object containing a field x and a field tags which contains bunch of strings...if we want to save in relational database we will create three tables one for the main object and other for the tags and other to map the tags to the main object..this forces us to write a mapping layer or use an ORM to translate between our object and memory and save into the database..
Many of us develop applications using object oriented concepts..our objects are not simply tables and rows.and we may use polymorphism or inheritance our objects are not uniform...mapping those into table and rows are quite a bit of pain...
In mongodb there is no schema to define...there are no tables and no relationsships between collection of objects,every document we save in mongo can be flat and simple and as complex as the applcation requires..This makes life as a developer much easier and the application code much cleaner and simpler..
- Mongo db has no schema no tables no rows no columns and certainly no relationships between tables.
- In mongo db we have single document write scope,a document lives in a collection but updating documents occur one at a time.so if any locking needed to occur it would be much simpler there is no need to extend locks across collections there are no relationships to enforce.
- Mongo also offers a special collection called capped collection which have a fixed size and automatically overwrites old documents.
Conclusion In this article we have learned what is Mongo db and how it is different from relational databases and the advantages..In coming articles we will see how to set up the mongo server and use it...