The Mongoose and NodeJs History

Introduction

In this article we hope to explain some of the history behind NodeJS, MongoDB, Mongoose, and how they became a common architecture among web developers.

Birth of NodeJS

Javascript is one of the most popular programming languages in this world. It is one of the three core technologies of the World Wide Web(WWW). When it was created, no one thought Javascript would become this popular in the future. It was just a programming language in the shadow of immensely popular Java. But soon web developers started using it for creating interactive web pages. Soon Javascript was combined with PHP, and a new era of web development began. Many websites still use this combination. As time passed, developers started experimenting more and more with Javascript. Then, javascript was only executed in browsers. As technology advanced, browsers failed to keep up with the pace. Then, Google came with its brand new browser, today we call it the Google chrome. It had a new javascript engine, the V8 engine.

The V8 engine was a brilliant invention. Then, Ryan Dahl at Google came with a new idea. Why not use this V8 engine to execute javascript on the server-side? This changed everything. Javascript is a brilliant programming language and instead of using it with other server-side languages such as PHP, why not use javascript only at the server-side?

Ryan Dahl took the V8 engine out of the chrome browser to a server. Then, nodejs was born. Now the developers had one language, both on the client-side as well as the server-side.

Why nodejs became so much popular?

Why? There are quite a few reasons for its popularity.

  1. A developer does not need to learn different languages for client-side and server-side. Javascript, already popular and fairly an easy language can be used on both ends. Now one developer who knew javascript could handle both the front-end and back-end whereas before it often took two developers with different skillsets to handle it.

  2. With nodejs, a new package manager also came out. We call it, Node Package Manager or NPM. It contains over 100,000 modules. It is very easy to use. You’ll commonly see packages installed with a simple line of code such as npm install mongoose. This is all you need to do to install the mongoose package, it’s that simple. It manages all the dependencies that mongoose itself needs behind the scenes.

  3. And there are few more reasons, but I will focus on the important one that is in the scope of this article, MongoDB. MongoDB is commonly used with Nodejs. MongoDB is a NoSQL database, and one of the most popular one. Also developers may prefer he schema-less structure to the rigidity of SQL databases, but each developer has his own preference.

MongoDB and mongoose

As the popularity of nodejs increased, new web application building stack, MEAN and MERN stack came out. In both of these, M and N stand for MongoDB and NodeJS, respectively. Using MongoDB is fairly easy when compared with Nodejs. But using MongoDB with Nodejs has one problem, abstraction failure. MongoDB is a schema-less database and the developers who came from SQL to MongoDB felt very uncomfortable working with dynamic collections of MongoDB that had no properly defined structure. This is where mongoose came into play and had a huge impact.

Mongoose is an Object Modelling Library(ODM). It is heavily used with nodejs when the database is implemented in MongoDB. One main advantage it provided was an abstraction. Now, the developers can define schema using mongoose. It overcame the one main problem. Moreover, MongoDB methods can easily be used in mongoose. Another important feature of mongoose is validations. Several other features such as plugins, middleware, population, etc came with it.

Today, the mongoose is an important library that is used heavily with Nodejs and MongoDB.

Conclusion

We hope this brief overview of some of the history behind NodeJS, MongoDB, and mongoose brought some insight into why these technologies are so popular. Thank you for reading another ObjectRocket knowledge base article!

Pilot the ObjectRocket Platform Free!

Try Fully-Managed CockroachDB, Elasticsearch, MongoDB, PostgreSQL (Beta) or Redis.

Get Started

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.