Your application always stores the data that is given to it by the user in the memory and then it stores that data to a storage medium device mainly the disk or other type of storage devices, and MongodDB uses memory mapped files as the server cannot stores all its information in the memory instead what it does is it creates a memory mapped array of files and map it using Memory Mapped file.

How are memory-mapped files used? Most commonly by operating system itself. Every time a binary image is loaded into memory, it is actually loaded there as a memory-mapped file. The file you see loaded into a process’s virtual memory address space are actually mapped there as memory-mapped files by operating system.

Mapped files presentation Mapped files presentation

As you can see in the picture above it shows how memory-mapped file is stored and how MongoDB uses that to make write faster in database, the same process happens when you read the data but in reverse, as this all happens by operating system the Mongo engine will then focus on delivering your data, it’s’ very good idea to leverage the operating system functionality, because its the core functionality of operating system it’s been worked a lot, optimized well and it’s really fast and stable.

Internal Storage.

So let’s talk about how your document or data is saved in other world what is the internal storage of MongoDB and the answer to this is BSON, BSON is a Binary JASON.

There are many advantages in BSON one of the most important of them is that it’s in binary it’s so close to the binary of operating system as a result it’s super-fast in writing and reading the data, another advantage is its also scheme-less.

Some of the key points of BSON are as bellow, these are by no means all the functionality but they are the most highlighted one, and also if you want to get more information about BSON then you can visit their site


  • Keep­ing spa­tial over­head to a min­im­um is im­port­ant for any data rep­res­ent­a­tion format, es­pe­cially when used over the net­work.


  • BSON is de­signed to be tra­versed eas­ily. This is a vi­tal prop­erty in its role as the primary data rep­res­ent­a­tion for Mon­goDB.


  • En­cod­ing data to BSON and de­cod­ing from BSON can be per­formed very quickly in most lan­guages due to the use of C data types