Archive for the ‘Miscellaneous’ Category

Over the years I have come across many blog posts and videos mentioning about funny business meeting illustrating how hard it is for an engineer to fit into the corporate world!

The below image and short video will enable us to understand why it is important to ensure that the business requirements are captured as per customer needs ans the deliverables align with the customer expectations.

I could not agree any more about the below image which depicts great criticism of business culture.


I have come across the below video which is so hilarious. This was Written & Directed by Lauris Beinerts, Based on a short story “The Meeting” by Alexey Berezin and shared on you tube.

Faced with the seemingly impossible task of drawing seven lines, the expert must not only deal with the challenges of this project, but also a client who doesn’t understand their own brief.  On top of this, his own team have misplaced priorities. Get ready for a hilarious time of enjoyment while watching this video.


MongoDB – Part 1

Posted: November 23, 2014 in Big Data
Tags: , , ,

Databases are the heart of any small or enterprise level software applications. Hence choosing a cost effective, high performance and scalable database is very essential for the success of the project in general and business in particular.


MongoDB is a scalable, high performance open source NoSQL Database.

MongoDB stores data using a flexible document data model that is similar to JSON. Documents contain one or more fields, including arrays, binary data and sub-documents. Fields can vary from document to document. This flexibility allows development teams to evolve the data model rapidly as their application requirements change.

Developers access documents through rich drivers available in all popular programming languages. Documents map naturally to the objects in modern languages, which allows developers to be extremely productive. Typically, there’s no need for an ORM layer.



1)Document-Oriented Storage

JSON (Java Script Object Notation) Document oriented (actually BSONBinary Script Object Notation). This facilitates dynamic schemas which offer simplicity and power.


Data in MongoDB has a flexible schema. Collections do not enforce document structure. This flexibility gives you data-modeling choices to match your application and its performance requirements.


2)Full Index Support

Index on any attribute, just like you’re used to.

3)Replication & High Availability

Mirror across LANs and WANs for scale and peace of mind.


Scale horizontally without compromising functionality.


Rich, document-based queries.


Flexible aggregation and data processing.


Relational databases save data in tables and rows and our application code hardly ever does that. There is a misalignment of application code objects to tables and rows in database. Hence we end up using some Object Relational Mapping technology such as NHibernate to translate the   database structure into application layer objects. This can be avoided using NoSQL database like MongoDB.



In MongoDB there is no schema to define, no tables and no relations between collections of objects. Every document we save in MongoDB could be very simple or quite complex based on the needs of the application layer which makes the life of the developer very easy and helps in writing cleaner code with less effort. Also since there is no schema defined for any document saved in the database it can be extended/changed as needed.


Why should I go for MongoDB?

1)Data Set is Big & Schema is Not Stable

Adding new columns to RDBMS can lock the entire database in some database, or create a major load and performance degradation in other. Usually it happens when table size is larger than 1GB. As MongoDB is schema-less, adding a new field, does not affect old rows (or documents) and will be instant. Other plus is that you do not need a DBA to modify your schema when application changes.

2)NO DBA Assistance

If you don’t have a DBA, and you don’t want to normalize your data and do joins, you should consider MongoDB. MongoDB is great for class persistence, as classes can be serialized to JSON and stored AS IS in MongoDB.

3)Need High Availability (Cloud and Real Life)

Setting replica Set (set of servers that act as Master-Slaves) is easy and fast. Moreover, recovery from a node (or a data center) failure is instant, safe and automatic

4)You Expect a High Write Load

MongoDB by default prefers high insert rate over transaction safety. If you need to load tons of data lines with a low business value for each one, MongoDB should fit.

Setting up MongoDB Server

Download the latest Mongo DB setup from the following location and install. You can download for either 32 bit operating system or 64 bit operating system.

Once you complete the installation of the setup navigate to the installation folder and you will find a bunch of executables and one among them is the Mongo Daemon executable.


Open command prompt with Run as administrator option.

Default location for MongoDB is \data\db

Once the folder exists on the file system then we can start the MongoDB server daemon. In case if we would like to store data in a different location then first create the database and later start MongoDB daemon service.

  • I have created a folder called D:\Database\MongoDB
  • Navigate to the folder in command prompt.
  • Identify the path of the mongod.exe file on your machine


  • Start MongoDB server daemon service


Note: Press CTRL + C to shut down the server.

To learn about the additional options type mongod –help | more


You will realize that we have option to write log files and set the verbose. Limit the maximum number of connections and providing all the inputs through a configuration file etc…

Let’s create a sample configuration file as shown below.


And start the service with the help of configuration file as shown below


If you do not want to start and stop the server daemon, you can as well choose to install it as a windows service on the machine.

Use the install option as shown below to install it as a windows service on the machine.



Now we can use net start mongodb and net stop mongodb commands to start and stop it.

Or alternately use the services console to start and stop the service as needed.

Test the connection to MongoDB server

Once the server is started use mongo,exe shell to connect to the server.


Open command prompt and type mongo.exe

It will connect to the server




How to insert a document

db.messages.insert({name:’Kishore’, message: ‘Hello’})

The name of the collection that we are creating in the above document is messages. It is equivalent to our table in RDBMS terminology

Now type db.messages.find()

It will retrieve all the entries in the collection.


To close the shell type exit in the command prompt


We can also download and install a tool called RoboMongo which will be an UI based client.















Hope you have enjoyed this post and in my next post, I will try to explain the concept of MongoDB Replication with examples.