all you need to know about mongoDB -1
Tags: mongodb, mocha, chai
Published: 2021-06-21 18:47:01

##what is MongoDB?


![image showing mongodb](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w97jiy3i08lbanc4oc6y.jpg)


Well, this may not seem new to many if I say that MongoDB is a no SQL database which is used due to various advantages it holds over relational databases such as MySQL, PostgreSQL. NoSQL databases (aka "not only SQL") are nontabular and store data differently than relational tables. NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph. They provide flexible schemas and scale easily with large amounts of data and high user loads. but, MongoDB is also a functional organization apart from the famous NoSQL database services provided by it MongoDB provides numerous other services such as cloud services for free and paid versions the free version is generous enough to provide up to 5GB storage.

[to explore more about MongoDB click me!](https://www.mongodb.com/)


##who is using MongoDB? 

MongoDB is one of the most widely used databases for various application fields. One learning this skill will be of most benefit to the organization and personal knowledge. The majority of the modern programming languages goes handy with MongoDB.

![sectors where mongoDB is beign used](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2igufe1yw7vrb5cdi3kp.jpg)

[customers that use MongoDB](https://www.mongodb.com/who-uses-mongodb)

##How does MongoDB work?

![Workflow of MongoDB](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q72lczxvy1l7l9kw751e.jpg)



But before proceeding to its working, first, let’s discuss some important parts of MongoDB –

###Drivers: 
 Drivers are present on your server that is used to communicate with MongoDB. The driver's support by MongoDB is C, C++, C#, and .Net, Go, Java, Node.js, Perl, PHP, Python, Motor, Ruby, Scala, Swift, Mongoid.
MongoDB Shell: MongoDB Shell or mongo shell is an interactive JavaScript interface for MongoDB. It is used for queries, data updates, and it also performs administrative operations.
Storage Engine: It is an important part of MongoDB which is generally used to manage how data is stored in the memory and on the disk. MongoDB can have multiple search engines. You are allowed to use your search engine and if you don’t want to use your search engine you can use the default search engine, known as WiredTiger Storage Engine which is an excellent storage engine, it efficiently works with your data like reading, writing, etc.

MongoDB work in two layers –
1.Application Layer and
2.Data layer

The Application Layer is also known as the Final Abstraction Layer, it has two parts, the first is a Frontend (User Interface) and the second is Backend (server). The frontend is the place where the user uses MongoDB with the help of a Web or Mobile. This web and mobile include web pages, mobile applications, android default applications, IOS applications, etc. The backend contains a server that is used to perform server-side logic and also contains drivers or mongo shells to interact with the MongoDB server with the help of queries.

These queries are sent to the MongoDB server present in the Data Layer. Now, the MongoDB server receives the queries and passes the received queries to the storage engine. MongoDB server itself does not directly read or write the data to the files or disk or memory. After passing the received queries to the storage engine, the storage engine is responsible to read or write the data in the files or memory it manages the data

[More on MongoDB architecture](https://www.guru99.com/what-is-mongodb.html#4)

##what is mocha and why do we need it?

###Mocha: 
Mocha is a testing framework that is used to perform tests within our application. It makes sure everything works correctly.
‘Mocha in Node.js’ means using the mocha unit testing framework in the Node.js runtime environment. Mocha has tons of great features.
Key Features:

1.Simple async support.
2.Async test timeout support.
3.Use any assertion library you want
4.Before, after, before each, after each hook is very useful to 
  clean the environment with each test.

![Mocha TDD](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c90ep5zljajztfg3lugx.png
)

*"This is an introductory post to explain my best on mongoDB and test development using maongodb with mocha in the follow up of this post i will be sharing more details 
installation and setup of MongoDB in your local system,commands,schema,etc.. and will try to provide insights on building a mini project with MongoDB database. pls do share your thoughts on this post as comments"*