One sweet design choice of MongoDB is that it uses memory-mapped files to
handle access to data files on disk. This means that MongoDB does not know
the difference between RAM and disk, it just accesses bytes at offsets in
giant arrays representing files and the OS takes care of the rest! It is
this design decision that allows MongoDB to run in RAM with no modification.
No pun intended, but until MongoDB added journaling (on by default since 2.0), I’ve always looked at MongoDB as an in-memory database. And, I have to confess that even after that, considering all the recommendations and stories I’m reading about MongoDB, I still perceive it as a mostly in-memory database.
Original title and link: How to use MongoDB Redis-style: pure in-memory database ( ©myNoSQL)