I came across a really strange scenario, the initial connection to mongoDb takes about 15 seconds. My current setup is this:
- mongodb runs inside ubuntu vm on the same machine
- mongodb - version 2.6.1
- node.js installed using brew and this is version 0.10.28
After restarting nodemon, the initial POST value takes about 15 seconds
POST /api/v1/signin 200 14707ms - 56b
another POST on the same route without rebooting the server is relatively fast:
POST /api/v1/signin 200 76ms - 56b
the reason this bothers me is that, since this project is still under development, nodemon tends to restart a lot, and testing becomes a pain.
I use the following node modules that are related to db and authentication:
- "express": "~ 4.2.0",
- "mongoose": "3.8.8",
- "": "0.2.0",
- "-": "0.1.6",
- "bcrypt": "*"
:
var mongoUrl = "mongodb://devmachine.local:27017/project";
mongoose.connect(mongoUrl, {auto_reconnect: true});
.