Disconnection with MongoDB after several minutes

Hi guys.
We have some issue i have no clue about reason.

We've built some apps to manage data stored in MongoDB databases (db ver. 4.0.0).

After several minutes (15-20) without any interactions with database when i try to perform some action (like running read or update queries) i'm getting these two issues:

  1. Attempted to check out a connection from closed connection pool
  2. Cannot use a session that has ended

What do you think could be a reason?

It's more about configuration, or retool itself ?

Best regards,
Kwapa