Skip to content
This repository has been archived by the owner. It is now read-only.
Profile query time when using mongoose-lean-virtuals.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

mongoose-virtuals-lean Profiler


This script is to profile the performance impact when mongoose-virtuals-lean is applied.

What it does?

This script run profiles the find() operation with different lean mode:

  • Lean mode on
  • Lean mode on with virtuals (This is of our interest!)
  • Lean mode off

Preparing the Environment

What do we need?

  • MongoDB (I'm using v4.0.5)
  • Node (I'm using v8.15.0)
  • Dependencies defined in package.json

Step 1: Download IMDB Dataset

We need a sample dataset for run the profiler. Thus, I chose the IMDB dataset.


mkdir imdb
gunzip title.basics.tsv.gz
mv title.basics.tsv ./imdb

Step: Get MongoDB Ready

We will set up a MongoDB for profiling purpose. I prefer to have it run with docker-compose, which the docker-compose.yml file is in this repo as well.

docker-compose up -d

Shell into our docker instance:

docker exec -it <container id> bash

We then import the dataset into our MongoDB instance.

mongoimport -u root -p root --authenticationDatabase admin --type tsv --headerline --db imdb --file ./title_basic.tsv

Try connecting to your MongoDB and see if the data are successfully imported.

mongo -u root -p root --authenticationDatabase admin imdb

In mongo shell, run:

> db.title_basic.count()

Up to now, your MongoDB is ready!

Running the Profiler

Install all necessary dependencies:

npm install
node --max-old-space-size=4096 src/index.js



You can’t perform that action at this time.