DEV Community

Discussion on: Testing Node.js + Mongoose with an in-memory database

Collapse
 
thestoicdeveloper profile image
The Stoic Developer

Hi, nice article. I would just like to remind people a few things regarding mongodb-memory-server, please someone correct me if I'm wrong:

1) it's faster (~3x) for a battery of parallel tests, because when you use a real database you're usually constrained to one process (github.com/nodkz/mongodb-memory-se...)

2) it's slower (~4x) for one off tests, because it has to create the database engine every time. This is how I code, I always have one test running many times while TDDing (based on my own testing).

3) it is has somewhat the same speed in the other cases (based on my own testing). Please remember that mongo >= 3.2 runs with a memory cache by default.

docs.mongodb.com/manual/core/wired...