Allow for session timeouts
For security reasons, it should be possible to configure a session timeout after which, if there has been no activity, the shell disconnects from MongoDB and the user has to reconnect.
AdminMassimiliano (Admin, MongoDB) commented
With mongosh, this is pretty easy to achieve by adding an exit() call in a setTimeout that gets reset every time the prompt is rendered. This can be done in ~/.mongoshrc.js.
Here is an example: https://gist.github.com/mmarcon/ee6440fc34df05923e76b9b3587b593a