When the mongo shell first starts up, it displays server startup warnings. However, if the server has been stopped and re-started — which might change its startup warnings — the shell does not inform the user of the server's startup warnings when it successfully reconnects. It would be better if it did, so that users/admins are fully informed about the current state of the server before proceeding to perform operations on it.
The naive approach would just be to fetch and re-display all startup warnings on reconnect. However, this would re-display the (unchanged) startup warnings if the network connection is lost. More advanced approaches could include:
- Attempting to diff the startup warnings compared to previously, and not re-displaying them if they are identical
- Attempt to distinguish between network disconnects and server restarts by checking the server's uptime (eg. from serverStatus), and only re-showing the startup warnings if the server uptime is less than the length of time that the shell's been disconnected. This is more complex because the shell doesn't notice immediately when the connection is lost.
- related to
-
SERVER-12743 shell doesn't test server version on reconnect
- Backlog
-
SERVER-17374 Shell prompt does not indicate reconnect to mongos
- Backlog