Skip to main content

What is MongoDB and Why MongoDB?

Recently I have playing a lot with MongoDB and it’s  one of the favourite document database. In this blog post we are going to learn about MongoDB in details.

What is MongoDB?

Those who don’t know MongoDB here is what documentation on MongoDB says about it.

MongoDB is a document database that provides high performance, high availability, and easy scalability. Document Database. Documents (objects) map nicely to programming language data types. Embedded documents and arrays reduce need for joins.
A MongoDB is one of popular database. A standard deployment can hold many databases. A database holds a set of collections. It's like similar to tables in relational databases. A collection holds a set of documents just like rows in relational database tables. A document is a set of Key value pair. It’s stores data in such a way that there is no relation is required. It was created by company called 10gen.

MongoDB supports almost all the languages and there are lits of drivers are available for MongoDB and it open sourced at Github at following location.

MongoDB Organizations can expect to receive all the benefits of database which delivers:
  • High Performance
  • High Availability
  • Easy Scalability 

Why MongoDB?

There are several reason why people choose MongoDB over other relations databases.

Flexiblility :
There are few things which makes MongoDB quite flexible.
  • You can store data in such way you want there is not restriction on database schema.
  • It’s works on any operating system so you can use it on any platform that your application requires.
Performance and Scalabiltiy:
It’s stored data in JSON format so that performance is blazing fast and It’s also supports indexes that will be again a great features. Another thing is you can easily shard MongoDB database so If your database is growing very fast you can have you data in different shards.

Minimum need for maintenance:
In normal relation databases we need to special database administrator maintain data in databases. While in MongoDB its very to manage and with very few command it will provide all the functionalities.

There many more reason why MongoDB is preferred choice for NO-SQL databases but this three are main.

MongoDB Features:

There are lots of features are provided by MongoDB and followings are few of them.

Instead of storing data in multiple relational tables MongoDB can store minimal numbers of documents like in blogs database you can store tags related to blog post in same document while in relational you might need to have separate table for that.

It’s supports indexes just like relational databases so data retrieval will be very fast.

Load balancing:
MognoDB supports sharding and you can use shard data at multiple locations. The user chooses a shard key, which determines how the data in a collection will be distributed. The data is split into ranges (based on the shard key) and distributed across multiple shards.

MongoDB also supports replication just like relational databases. It’s supports replication with replica sets. Each replica set contains two or more copies of the data. There will be two replica set will be there. One replica will act as Primary replica which performs read and write operation while other secondary replica set will create copy of data on top of Primary replica set. If primary replica set will fail then secondary replica set will act as primary and performs all operations of primary.

There are many more features available but this four were main features of MongoDB.  You can find all features of MongoDB as following location.

That’s it. Hope you like it. Stay tuned for more!


Popular posts from this blog

How to create Rest API(Web API) with ASP.NET Core 1.0

Recently Microsoft has released ASP.NET Core 1.0 RC2, I am getting lots of request from readers that about creating Web API. So I thought it will be a good idea to write a blog post about how to create Rest API(Web API) with ASP.NET Core 1.0.

So let’s get started via creating an ASP.NET Core 1.0 Web Application like following.

Once you click on ASP.NET Web Application, It will ask whether you need to create Web Application or Web API application. We are going to Web API so I am going to select Web API Application like following. Please note that in ASP.NET Core 1.0 there is no separate libraries or DLLs required for creating web APIs. This is just a project template.

Now once you click on OK It will create a Web API application with default values controller and program.cs.  As you know Program.cs is now starting point for the ASP.NET Core 1.0 application so It contains all the required configuration and startup items. Following is a code for that.
using System.IO; using Microsoft.Asp…

How to use migration with Entity Framework Core

Entity framework core is  the lightweight, extensible and cross-platform version of Entity Framework. Before some time, Microsoft has Released a new version of Entity Framework RC2. I have written a couple of blog post about Entity framework code first migration earlier for Entity framework 6.0. So there was a couple of request coming for writing a blog post about Entity Framework Core RC2 migration. So I thought it will be a good idea to give an overview how database migration works in Entity Framework Core RC2. This post will cover a basic scenario where we are going to create the database with existing ASP.NET Identity migration and then we are going to create a new model and have that migration applied in the database.

How to use Entity Framework Migrations: Let’s get started, To demonstrate entity framework core migrations, I am going to create a sample core web application like following.

Once we select core application it will appear the following dialog.

Now w…

Creating PDF with ASP.Net MVC and RazorPDF

Update: I have written a new blog post about better approach to create a PDF with mvc- You can find that following location.- A Better Solution to create PDF with Rotativa and ASP.NET MVC
In this post we are going to learn how we can easily create PDF from ASP.Net application with the help of Razor PDF NuGet package.

About Razor PDF:
This NuGet package is created by Al Nyveldt It internally uses ITextSharp an open source PDF convertor library. RazorPDF uses Razor View engine to create iTextXML which is in tern used to produce PDF file. You can get more information about that at below link.

Example(Creating PDF with ASP.Net MVC):
So what we are we waiting for ? Let’s create a simple example. To create example first thing we need to a create and ASP.Net MVC application.