odmantic
odmantic copied to clipboard
Check connection to db
How to check connection to mongoDB using odmantic?
Hello, you mean to check if the mongo server is up ?
yup
Right now, there is nothing unfortunately. If the database is not there, the motor_client will hang.
This is the default behavior of motor but it would be possible to add the connectTimeoutMS
kwarg while building the motor client. Normally, this should default to 20 seconds (as mentionned in the pymongo docs) but i'm not sure this is the case with the default parameters of motor.
Anyway, for now you can create manually the motor client, passing it the connectTimeoutMS you want. Then you'll be able to create the engine from this existing client :smile: