Blog

What is MongoDB and how does it differ from sql?

Beep! Beep! Beep! Sleepily, you yawn and peek your eyes open to see your alarm clock staring back at you. Stumbling out of bed, you methodically brush your teeth and shower. With a towel as your only defense against the cold, you look around your room you ask yourself "What should I wear today?" Your choice can be detrimental on how your day goes. Going for a run in sandals or wearing a tank top in the snow do not sound like fun experiences. Choosing what database to use for a project can be just as important.

// What is MongoDB?

MongoDB is a popular free and open-source NoSQL(Not only SQL) database. A sneaker can be defined by its characteristics i.e. a soft shoe with a rubber sole, MongoDB can be better understood by its features. Its first key feature is faster queries and less data transfer activity. The second is a replication facility called replica set that provides automatic failover, a way to protecting the database against failure and data redundancy. Lastly automatic scaling, as the amount of data stored increases it is able to shard, a method for distributing data across multiple machines.

// How does it differ from SQL?

Just like shoes have categories like sneakers or high heels, databases are similar. They are broken up into SQL(relational databases ) and NoSQL (non-relational databases). Relational databases represent and store data in tables and rows while non-relational databases like MongoDB store data in collections of JSON documents. According to the documentation from MongoDB, "When compared to relational databases, NoSQL databases are more scalable and provide superior performance." It is also able to handle large volumes of structured, semi-structured, and unstructured data, agile sprints, quick iteration, frequent code pushes and efficient and scale-out architecture.

Just like wearing sneakers in all weather conditions doesn’t make sense, using one database type for all your projects might make your life unnecessarily more complicated. Being familiar with the differences of database advantages could go a long way to making better database decisions and being more efficient.