I am using MongoDb/PHP on a Linux server. The problem is that, if a query takes too long to execute, the mongo server stop (apache keeps running). So is there any way ,so that I can limit the time for a query to execute, and kill the process automatically like in php- max execution time ?
Till now I have found:
socketTimeoutMS
, but I found some where , it will not kill the process.- cursor.maxTimeMS() , but I have to define it for each query.
So can anyone please suggest which approach I should follow so that
- the query is automatically killed, if it takes more time,
- I don't need to change every query.
maxTimeMS
default sounds appealing, but a per-user limitation probably makes more sense.