MongoDB is an open-source document-oriented database. It is used to store a larger amount of data and also allows you to work with that data. MongoDB is not based on the table-like relational database structure but provides an altogether different mechanism for storage and retrieval of data, that’s why known as NoSQL database. Here, the term ‘NoSQL’ means ‘non-relational’. The format of storage is called BSON ( similar to JSON format).
Now, let’s see how actually this MongoDB works? But before proceeding to its working, first, let’s discuss some important parts of MongoDB –
- Drivers: Drivers are present on your server that are used to communicate with MongoDB. The drivers support by the MongoDB are C, C++, C#, and .Net, Go, Java, Node.js, Perl, PHP, Python, Motor, Ruby, Scala, Swift, Mongoid.
- 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 own search engine and if you don’t want to use your own 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.
Working of MongoDB –
The following image shows how the MongoDB works:
MongoDB work in two layers –
- Application Layer and
- Data layer
Application Layer is also known as the Final Abstraction Layer, it has two-parts, 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 which is used to perform server-side logic and also contain drivers or mongo shell to interact with 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 basically it manages the data.
Note: The reading and writing from the files are slow as compare to memory.
- MongoDB Projection
- MongoDB and Python
- MongoDB : An introduction
- MongoDB: Getting Started
- MongoDB - Less than Operator $lt
- MongoDB vs MySQL
- Introduction about Node.js and MongoDB
- MongoDB - Equality Operator $eq
- MongoDB - Inequality Operator $ne
- MongoDB - Greater than Operator $gt
- MongoDB - Less than equals to Operator $lte
- What is MongoDB - Working and Features
- Difference between RDBMS and MongoDB
- How to install MongoDB on MacOS ?
- MongoDB - Embedded Documents
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.