Deal with // comments multiline history better
This is a papercut in the legacy shell which would make the modern shell even more usable by comparison...
Currently, both the new and legacy shell have an issue with the way they store a multiline command (eg. when defining an aggregation pipeline) as a single line in its history.
Often (especially for aggregation pipelines) inputted commands will contain // comments. For example, see the code snippet 'var pipeline = [...];' here: https://www.practical-mongodb-aggregations.com/examples/simple-examples/group-and-total.html
The reason why this shell behaviour is problematic is discussed in the Practical MongoDB Aggregations book chapter at https://www.practical-mongodb-aggregations.com/guides/composibility.html
(scroll 2/3 down that page and read the 'punchout' text shown)
In short, if the command contains '//' comments it breaks when re-run from the history (even if the history command is not edited by the user). Need a way to allow the command to still be re-executed from history without failing (whether edited inline or left as-is, before re-running).
I don't have one single way to recommend about how this should be implemented, but some options (each with likely relative pros/cons) are:
When saving a multi-line command, in the shell's history, replace // comments with /.../ commands (but would have to be careful if some of the text already containing /.../ comments).
Store the version of the command retaining multi-line characters but then only show it in the history as a single line (this would be fine for just pressing Up followed by Execute, but might be problematic when editing the command between Up and Execute).
Also, ideally, when using an inline text editor, the inline text editor would show the history command with its multi-lines retained.