3

I have hosted my mongodb in mongolab. I have created a ODM in loopback and made a connection to mongolab. Sometimes the connection gets established but other times due to bad connection it gets timedout. I want to increase this timeout so that it does get connected everytime. I did not find any solution even on Strongloop site.

I tried even adding a query string param in connection string for mongolab: ?connectTimeoutMS=1000000 Even this did not help.

1 Answers1

6

Use the connectionTimeout setting in your dataSources.json file.

{
  "YourMongoDB": {
    "name": "YourMongoDB",
    "connector": "mongodb",
    "connectionTimeout": 1000000
  }
}
Bryan Clark
  • 2,542
  • 1
  • 15
  • 19