Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase connection timeout for Mongolab while connecting from loopback mongodb driver

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.

like image 933
Anurag Dwivedi Avatar asked Mar 21 '26 08:03

Anurag Dwivedi


1 Answers

Use the connectionTimeout setting in your dataSources.json file.

{
  "YourMongoDB": {
    "name": "YourMongoDB",
    "connector": "mongodb",
    "connectionTimeout": 1000000
  }
}
like image 181
Bryan Clark Avatar answered Mar 22 '26 21:03

Bryan Clark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!