MongoDB Shell

The MongoDB Shell (mongosh) lets you connect to MongoDB to work with your data and configure your database.

Help us improve the MongoDB Shell by posting your ideas and suggestions for improvements.

To report bugs, please use our MONGOSH JIRA project.

  1. Support .mongorc.js file

    A core bit of functionality from the original shell is to support reading from the .mongorc.js file in a user's home directory. This feels like core functionality that mongosh should support.

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Usability  ·  Flag idea as inappropriate…  ·  Admin →
  2. Ability to execute a javascript file from inside the shell

    Currently the only way to execute a javascript file from the mongo shell is to re-direct the input at shell login time (e.g. mongo --username <username> ... < myscript.js). It would be helpful to have a way to execute the script from inside the shell via some sort of "run" command (e.g.from inside the shell "run /my/path/myscript.js".

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Commands  ·  Flag idea as inappropriate…  ·  Admin →
  3. Bracket matching and highlighting

    Something which I miss from the legacy shell is bracket matching and highlighting, so I can tell when I have too many brackets, or they're in the wrong order

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Usability  ·  Flag idea as inappropriate…  ·  Admin →
  4. 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…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Flag idea as inappropriate…  ·  Admin →

    Starting with version 1.0.6 of mongosh, single-line comments are replaced with /**/.

    There is no simple way to retain multi-line in history but I will split that into a separate suggestion to keep track of it.

  5. Control-C to cancel current execution only - without exiting from mongo shell

    when you started some complex query and realized that it could take time - you want to cancel it. if you press Control-C you will be kicked out of mongo shell. so you have to login back and switch to proper database; probably, set all variables again etc.

    there should be option to cancel just current execution leaving you in current session.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Usability  ·  Flag idea as inappropriate…  ·  Admin →

    This is available in mongosh 0.13.1+. When you do Ctrl-C, the shell will attempt to cleanly kill the operation on the server and get you back to the prompt right away.

  6. Add history search

    Add ability to search through the command history using Cmd/Ctrl+R. It would be nice to also being able to search through the scripts entered with .editor

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    completed  ·  2 comments  ·  Usability  ·  Flag idea as inappropriate…  ·  Admin →
  • Don't see your idea?

MongoDB Shell

Categories

Feedback and Knowledge Base