I am facing a really weird scenario, the initial connection to mongoDb takes around 15 seconds. My current setup is the following:
- mongodb running inside an ubuntu vm on the same machine
- mongodb is version 2.6.1
- node.js installed using brew and it is version 0.10.28
Upon restarting nodemon the initial signin POST takes around 15 seconds
POST /api/v1/signin 200 14707ms - 56b
other POST to the same route without restarting the server is relatively fast:
POST /api/v1/signin 200 76ms - 56b
the reason why this bothers me is that because this project is still in development, nodemon tends to restart a lot and testing is being a pain.
I am using the following node modules which are related to db and authentication:
- "express": "~4.2.0",
- "mongoose": "3.8.8",
- "passport": "0.2.0",
- "passport-local": "0.1.6",
- "bcrypt": "*"
this is the way i am connecting to mongo:
var mongoUrl = "mongodb://devmachine.local:27017/project";
mongoose.connect(mongoUrl, {auto_reconnect: true});
any help would be highly appreciated.
Thanks