DEV Community

Hasan Zohdy
Hasan Zohdy

Posted on

14-Nodejs Course 2023: Introduction To MongoDB

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
Enter fullscreen mode Exit fullscreen mode

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.


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

Packages & Libraries

React Js Packages

Courses (Articles)

Top comments (0)