Docs Menu

mongosh Changelog

On this page

Released October 7, 2021

New features in this release:

  • Adds support for the edit command and $EDITOR variable.
  • Auto-complete for databases and collections is now case-insensitive.

Released September 22, 2021

New features in this release:

mongosh now uses the following driver versions:

Full release notes available on JIRA.

Released September 14, 2021

New features in this release:

  • You can now run sh.status() when not connected to a mongos, for example when connected to a config server.
  • db.setSecondaryOk(), mongo.setSecondaryOk(), and rs.secondaryOk() methods are reintroduced but deprecated. These methods alias to mongo.setReadPref().
  • When you enter multiline input into the shell, single-line // comments are now preserved as /* comments */ in the history entry.

Bug Fixes in this Release:

  • mongosh now runs aggregations with $out or $merge immediately, and not lazily once the result of the aggregation is accessed.
  • Using the legacy NumberLong() method no longer truncates numbers outside of the 32-bit range.

Full release notes available on JIRA.

Released August 12, 2021

New features in this release:

  • You can use config.set('maxTimeMS', <number>) to set a default maxTimeMS value for operations. maxTimeMS specifies a time limit in milliseconds within which the operation must complete.

    Note

    config settings persist across sessions.

  • On Windows, you can start mongosh by double-clicking on the .exe file. When you do, mongosh prompts you for a connection string to connect to your deployment.
  • The log files created by mongosh follow the format of the mongod, mongos, or mongocryptd. Meaning, the log files are newline-delimited JSON with the same set of fields used by the server.

Released August 4, 2021

New features in this release:

  • mongosh now uses version 4.1.0 of the Node.js driver, with full support for connections to load balancers and MongoDB Atlas serverless instances.

Bug fixes in this release:

  • The Timestamp() argument order is now reversed compared to previous mongosh versions.

Released July 29, 2021

Bug fixes in this release:

  • Passing the exit code to quit() works like it does in the legacy shell.
  • Instances of MaxListenersExceededWarning are no longer emitted when methods like console.log() are used in loops.
  • When an internal error in mongosh occurs, the error message points you to the log file for the current mongosh session.
  • When printing the name of a collection (such as in response to db.coll), the database name is included in the output.

Released July 21, 2021

New features in this release:

  • Adds full support for the --host flag.
  • Adds the --build-info flag which provides detailed information about the mongosh version.
  • When using Kerberos, mongosh will now make use of tokens if they are still valid. You no longer need to specify a password when using valid tokens.

Bug fixes in this release:

  • An issue that sporadically resulted in an AcquireCredentialsHandle error on Kerberos was fixed.
  • Miscellaneous other improvements.

Released July 9, 2021

New features in this release:

  • All the static methods of the Node.js driver BSON classes are now available. Specifically, you can use ObjectId.createFromTime(unixTimestampSeconds) instead of the legacy shell’s ObjectId.fromDate(dateObj).
  • When connected to an Atlas deployment, the default mongosh prompt displays Atlas instead of Enterprise.
  • The cursor referred to when using it is cleared when either db is reassigned or db.auth() / db.logout() is called.
  • Minor bug fixes and improvements.

Released July 1, 2021

New features in this release:

  • mongosh now color coordinates matching brackets.

Released June 25, 2021

New features in this release:

  • mongosh now shows the current database name in prompt by default.

Released June 22, 2021

New features in this release:

  • .tar and .zip mongosh download archives now include a parent directory.
  • Autocomplete is now aware of the --apiStrict flag. When --apiStrict is true, autocomplete only completes methods that work with your defined API version. For more information, see Versioned API.

Bug fixes in this release:

  • mongosh can now connect to a replica set containing unhealthy nodes.

Released May 28, 2021

New features in this release:

  • When you run show collections, the type of collection is shown in the output.
  • Adds sh.reshardCollection() for resharding support.
  • Adds inspectCompact option to the configuration API to print each document field on its own line.

Released May 18, 2021

New features in this release:

  • When you use Ctrl+C to interrupt an operation, you interrupt operations that are running on the server, and not just local JavaScript execution.
  • .editor sessions are aggregated into one item in shell history.
  • Build and publish packages for all platforms in the current MongoDB 5.0 server support matrix.
  • Publish Windows MSI to the download center.
  • Adds a customizable REPL prompt using prompt (or your .mongoshrc.js file).
  • When running against a MongoDB 5.0 deployment, shows reasons for document validation failures.
  • Adds basic support for the --apiStrict flag.

Released April 30, 2021

New features in this release:

  • Adds support for the db.hello() shell method and hello database command. Use these commands in place of isMaster.
  • Extends the shell customization API to allow controlling log verbosity.
  • Adds autocomplete for show and use commands. For example, show collections and use test.

Bug fixes in this release:

  • collStats now works properly on sharded collections.

Released April 23, 2021

  • New async rewriter, allowing for a much wider range of JavaScript features in the shell.
  • Connection failure response is now more prompt if a connection is deemed unlikely to succeed.
  • Adds new API for shell customization.

Released April 8, 2021

Internal improvements and various bug fixes.

Released April 1, 2021

Internal improvements.

Released March 31, 2021

New features in this release:

  • Support for loading a .mongoshrc.js file at startup. Use this file to bootstrap the shell with customizations and extended functionality.
  • Ability to load scripts from the command line.
  • Support for --eval option.
  • Support for --tlsCertificateSelector on Windows and macOS.

Bug fixes in this release:

Released March 10, 2021

New features in this release:

  • Support for the load() method.
  • Support for AWS IAM authentication.

Bug fixes in this release:

  • Autocomplete works properly when connected to secondary node.
  • db.createUser() on $external database now handles password properly.
  • Miscellaneous other improvements.

Released February 24, 2021

Minor internal improvements and bug fixes.

Released February 22, 2021

Minor internal improvements and bug fixes.

Released February 17, 2021

New features in this release:

Bug fixes in this release:

  • Running setReadConcern no longer reverses db.auth() authentication operations.
  • Pressing the backspace key in the password prompt no longer adds an asterisk, and now behaves as expected.
  • Running UUID() without a value now generates a random UUID.

Released February 3, 2021

New features in this release:

Bug fixes in this release:

  • mongosh no longer fails when connecting to a node in the STARTUP2 state.
  • mongosh now properly displays startup warnings.
  • explain() on aggregations now return accurate and complete results.

Released November 30, 2020

New features in this release:

Bug fixes and miscellaneous updates in this release:

  • Remove support for deprecated 3.6 CRUD methods (insert(), remove(), save(), and update()).
  • Fix an issue with loading JavaScript files into mongosh.
  • Fix an issue where when inserting many documents via a for loop, the loop would abort before all documents were inserted.
  • Fix issue with output when printing result of a cursor.
  • Update the Node REPL to use Node version 14.

Released November 11, 2020

  • Autocomplete now works properly when connected to a MongoDB 4.4.1 deployment.
  • The sh.status() method now outputs correctly in the browser shell.

Released October 12, 2020

  • Adds support for replica set management methods.
  • Adds support for sharded cluster management methods.

Released October 1, 2020

  • Adds support for collection names with a dot. For example, to query a collection named my.collection, you can run:

    db.my.collection.findOne()

Released September 15, 2020

Released September 14, 2020

This release adds support for:

  • New cursor methods
  • Query planCache methods
  • Error helper methods
  • The following helper commands:

    • show users
    • show profile
    • show logs
    • show log[<name>]

This release includes an .rpm artifact which can be downloaded from the MongoDB Download Center.

Whenever a command's output includes { ok: 0 }, mongosh throws an exception and does not return the raw output from the server.

The legacy mongo shell error handling is not consistent between commands. mongosh standardizes the user-facing behavior for a more consistent experience.

  • MONGOSH-323: getUser() userId field is outputted as binary.
  • MONGOSH-337: Linux tarball is not gzipped.
  • MONGOSH-341: Wrong values with NumberLong for numbers > Number.MAX_SAFE_INTEGER. As a result of this fix, values passed to NumberLong and NumberDecimal must be strings.

    Important

    The fix for MONGOSH-341 is a breaking change when compared to behavior in the legacy mongo shell.

  • MONGOSH-346: Ctrl+C does not terminate the currently running command in the shell.

    Note

    Ctrl+C terminates the process in the shell, but does not terminate the process on the MongoDB server.

Released August 31, 2020

This release adds support for the following APIs:

  • Credentials are now properly redacted in logging and history.

For information on past releases, refer to mongosh Releases on GitHub.

Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.