One of the shortest and easy to understand explanations of how MongoDB memory-mapped file data access works offered by Sergio Tulentsev on StackOverflow:
MongoDB uses memory-mapped files for its data file management. What this actually means is that mongo doesn’t load documents from disk. Instead it tries to access a memory page where that document is located. If that page is not yet in RAM, then the OS goes ahead and fetches it from the disk.
Writing is exactly the same. Mongo tries to write to a memory page. If it’s in RAM, then it’s ultra-fast (just swapping some bits in the memory). The page is marked dirty and the OS will take care of flushing it back to disk (persisting your changes).
If you have journal enabled, then your inserts/updates are somewhat more expensive, as mongodb has to make another write to the append-only file.
Original title and link: MongoDB, Memory-Mapped Files, and Data Access ( ©myNoSQL)