Updating with further fixes;
thanks to Anna’s help, any of the following fixes mongosh failing to terminate on exit (hanging). Tested this on CentOS 7, using MongoDB version 5.0.9, and mongosh 1.5.0, though I suspect any MongoDB 5 and mongosh <1.6 will have the same issue.
- prepend to any eval commands, or issue open entering mongosh, the following command;
db._mongo._instanceState.evaluationListener.ioProvider.close = () => {}; - terminate any eval or mongosh session with
process.exit()instead ofexit - upgrade to mongosh version 1.6.1
If you can manage it, I’d suggest the upgrade as the best option.