14-Nodejs Course 2023: Introduction To MongoDB
Tags: node, typescript, mongodb, fastify
Published: 2022-10-31 05:15:21

---
title: 14-Nodejs Course 2023: Introduction To MongoDB
published: true
description: 
series: Nodejs Course 2023
tags: nodejs, typescript, mongodb, fastify
#cover_image: 
# Use a ratio of 100:42 for best results.
---


## 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](https://www.mongodb.com/try/download/community) 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.

```bash
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](https://github.com/hassanzohdy/nodejs-2023)

## 😍 Join our community

Join our community on [Discord](https://discord.gg/vtZE9YzaFz) 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](https://www.youtube.com/playlist?list=PLGO8ntvxgiZMJc7RN2lIq9WmMOlWZGzmz), 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](https://dev.to/hassanzohdy/event-driven-architecture-the-best-paradigm-that-i-love-to-work-with-in-javascript-and-node-js-1gnk)
- [Best Practices For Case Styles: Camel, Pascal, Snake, and Kebab Case In Node And Javascript](https://dev.to/hassanzohdy/best-practices-for-case-styles-camel-pascal-snake-and-kebab-case-in-node-and-javascript-55oi)
- [After 6 years of practicing MongoDB, Here are my thoughts on MongoDB vs MySQL
](https://dev.to/hassanzohdy/after-6-years-of-practicing-mongodb-here-are-my-thoughts-on-mongodb-vs-mysql-574b)

Packages & Libraries

- [Collections: Your ultimate Javascript Arrays Manager](https://dev.to/hassanzohdy/collections-your-ultimate-javascript-array-handler-3o15)
- [Supportive Is: an elegant utility to check types of values in JavaScript](https://dev.to/hassanzohdy/supportive-is-an-elegant-utility-to-check-types-of-values-in-javascript-1b3e)
- [Localization: An agnostic i18n package to manage localization in your project](https://dev.to/hassanzohdy/mongez-localization-the-simplest-way-to-translate-your-website-regardless-your-favorite-framework-4gi3)

 React Js Packages

- [useFetcher: easiest way to fetch data in React Js](https://dev.to/hassanzohdy/usefetcher-the-easiest-way-to-fetch-data-in-react-45o9)

Courses (Articles)

- [React Js: Let"s Create File Manager With React Js and Node Js](https://dev.to/hassanzohdy/lets-create-a-file-manager-from-scratch-with-react-and-typescript-chapter-i-a-good-way-to-expand-your-experience-5g4k)