1. Introduction to MongoDB
MongoDB was first born by MongoDB Inc. in October 2007. It was part of the PaaS (Platform as a Service) product like Windows Azure and Google App Engine. It was later made open source in 2009.
MongoDB uses JSON like files schemas, meaning data are stored as documents or collections which can be strings, numbers, floats and even arrays and objects.
MongoDB is also known as NoSQL database; it allows the insertion of data without interrupting the service and provides the real-time application changes.
Due to the vast complexity in web development and usage, the relational database cannot cope with the scale and agility
challenges of modern applications. When comparing relational database to NoSQL, the NoSQL database has better performance and is more scalable.
2. Pros and Cons of MongoDB
The outstanding advantages of MongoDB convincing the choice of current users are:
Since MongoDB uses data in the JSON form, each collection has different sizes and documents. Nevertheless, they are very flexible when it comes to archiving.
MongoDB data is usually not bound to each other; it does not support join query like in RDBMS, so when users insert, delete or update, it will not spend too much time to check if it satisfies the constraints like in RDBMS or not.
MongoDB is easy to scale. In MongoDB, the concept “cluster” refers to clusters of nodes containing data to communicate with each other. Adding a new node to the cluster helps users expand the system quickly.
The unique identifier _id will always be indexed automatically, so the speed of querying information will consistently achieve the highest performance.
The unique identifier _id will always be indexed automatically, so the speed of querying information will consistently achieve the highest performance.
3. What Is Mongoose?
Mongoose is a query language to communicate between the server and the database and performs reading, writing, updating and deleting operations of the data.
It is an Object Data Modeling (ODM) library for MongoDB and NodeJS which provides schemas to model application data which therefore cleans up the ambiguity of databases.
It enforces a standard structure to all the documents in a collection using schema.
It also validates the stored data in the documents as well as allow only valid data to be saved in the database.
Overall Mongoose provides all the features to the MongoDB including
query building functions and business logic in the data.
Top comments (0)