Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Completed
Categories MongoDB Shell
Created by Guest
Created on May 11, 2021

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.
  • Guest
    Feb 28, 2022
    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