Hi,
is there a way to set queries timeout with command within single transaction?
In other words, i’m looking for equivalent command to
SET LOCAL statement_timeout TO 200;
Thanks for a help in advance!
Hi,
is there a way to set queries timeout with command within single transaction?
In other words, i’m looking for equivalent command to
SET LOCAL statement_timeout TO 200;
Thanks for a help in advance!
Hi @Mateusz_Glowinski and welcome to the MongoDB Community !
I think you are looking for the wtimeout
that you can set in the writeconcern
parameter of the session.startTransaction
function.
Cheers,
Maxime.
Thank you @MaBeuLux88 for a really nice hint, but this will not solve my problem.
What I’m actually trying to do, is to use djongo package to communicate with MongoDB. I want to get an database error, once a query takes too much time.
Something similar to this.
In Python (and equivalent in the other drivers of course) you have max_time_ms
on cursors: cursor – Tools for iterating over MongoDB query results — PyMongo 4.3.3 documentation
There are also a bunch of timeouts that you can set in the connection string: https://www.mongodb.com/docs/manual/reference/connection-string/ (CTRL + F for “ms” to find them all).
I hope this helps,
Maxime.
Thank you, that is exactly what i need!
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.