14-Nodejs Course 2023: Introduction To MongoDB
Hasan Zohdy
Posted on October 31, 2022
What is MongoDB?
MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need.
MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era. No database makes you more productive.
MongoDB is a document database, which means it stores data in JSON-like documents. We call the format BSON
, which stands for Binary JSON. BSON
extends the JSON model
to provide additional data types and to be more efficient.
How does MongoDB work?
Consider MongoDB as a list of tables which we call it collections
. Each collection is a list of documents, which we can call it also an row
or a Javascript-Like object, each document has a unique _id
field by default and list of columns/fields/properties or whatever you like to call it.
So we basically create a collection with whatever name we want, we can then directly insert any data we want, integers, strings, arrays, objects, etc. and we can also create a schema for our collection, which means we can define what fields we want to have in our collection and what type of data we want to have in each field, but this is not a must, we can insert any data we want without a schema.
Installing MongoDB
Go to MongoDB and download the latest version of MongoDB for your operating system.
Installing NodesJS MongodB Driver
Now once we're done with installation, let's install the MongoDB driver for NodeJS.
yarn add mongodb
And now we're done.
What about Mongoose
Well, we're not going to work with, if you don't know what is Mongoose, it's an Object Data Modeling (ODM) library for MongoDB and NodeJS, it basically helps us to work with MongoDB in a more object-oriented way, but we're not going to work with it in this course, we're going to work with the MongoDB driver directly.
But we're going to build our own own database engine with our preferred structure, so we're not going to use Mongoose.
Conclusion
In this lesson, we learned what is MongoDB and how does it work, we also installed MongoDB and the MongoDB driver for NodeJS.
In our next lesson, we will learn how to connect to MongoDB using NodeJS in our project.
🎨 Project Repository
You can find the latest updates of this project on Github
😍 Join our community
Join our community on Discord to get help and support (Node Js 2023 Channel).
🎞️ Video Course (Arabic Voice)
If you want to learn this course in video format, you can find it on Youtube, the course is in Arabic language.
💰 Bonus Content 💰
You may have a look at these articles, it will definitely boost your knowledge and productivity.
General Topics
- Event Driven Architecture: A Practical Guide in Javascript
- Best Practices For Case Styles: Camel, Pascal, Snake, and Kebab Case In Node And Javascript
- After 6 years of practicing MongoDB, Here are my thoughts on MongoDB vs MySQL
Packages & Libraries
- Collections: Your ultimate Javascript Arrays Manager
- Supportive Is: an elegant utility to check types of values in JavaScript
- Localization: An agnostic i18n package to manage localization in your project
React Js Packages
Courses (Articles)
Posted on October 31, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.