mongo-shellmongosh

Mongosh 2.x only display the result of the last command when running multiple commands?


I recently upgraded from Mongosh 2.0.1 and noticed a change in behavior when running multiple commands in the shell.

In older versions of Mongosh, if I ran:

JavaScript

\> db.a.find();

-- output of db.a.find()

\> db.b.find();

-- output of db.b.find()

Show more lines

I would see the output for each command immediately after running it.

However, in the latest version (2.5.0), if I run:

JavaScript

\> db.a.find();

\> db.b.find

-- output of db.b.find()

Both commands execute, but only the result of the last command (db.b.find()) is displayed. The first command runs but its output is not shown.

Is there a configuration or setting in the latest Mongosh that allows me to restore the old behavior (showing output for each command as it runs)? Or is this an intentional change?


Solution

  • This appears to be a side-effect of bracketed paste, which was introduced with MongoDB Shell v2.3.9. There is a ticket tracking this behavior at MONGOSH-2201.