There’s a New Compass and It Comes With a Shell!

In Compass 1.22 Beta we are introducing the integrated MongoDB Shell, which allows you to run database commands and scripts directly from Compass.

Last week at MongoDB.live we introduced Compass 1.22 Beta, which comes with an integrated MongoDB Shell.

Compass is the easiest way to interact with your data in MongoDB: as we built it over time, we’ve always focused on simplicity and on exposing the features of the database through a user-friendly interface.

With this new version of Compass, we are offering a new way to work with MongoDB: when you need to go beyond what the UI offers, you can quickly pull up the shell, type any database command and see the results without having to go to the terminal and connect to your server or cluster again.

How it Works

When you are connected to a cluster in Compass, you will see that at the bottom there is a new “MongoSH Beta” component. If you click on that, you will have quick access to the integrated MongoDB Shell. The shell is already connected to your cluster and you can start typing commands right away.

Syntax Highlighting & Autocomplete

The integrated MongoDB Shell includes syntax highlighting to enhance readability and to make it easy to understand the structure of documents and command results and to quickly distinguish data types.

Additionally, the shell comes with intelligent autocomplete to help make sure you are writing the right commands or query operators and to save time when typing.

Scripting

The integrated MongoDB Shell is a great place to execute bulk operations and run scripts. You can use any supported MongoDB command and write JavaScript in the same way you are used to doing in the shell.

For example, in the screenshot below you can see how I used a simple script to grab all the documents in the collection, reformat the field names from camel-case to snake-case and then do an insertMany() to insert the resulting documents back into a new collection.

What Comes Next

What you see in Compass 1.22 is just the beginning. With this first integration, we embedded the MongoDB Shell into the Compass UI so you don’t need to jump to the terminal and connect again to be able to run database commands and scripts.

The next thing we will be looking at is a deeper integration between the shell and the rest of the user interface. For example, when you run a find() in the shell, the results will be available in the Documents tab. As this is something we are still designing and prototyping, your feedback is extremely valuable: feel free to reach out and let us know what you think.

Try Compass 1.22 beta today and let us know what you think about the integrated shell. Join the discussion at the MongoDB Community Forums or share your feature requests using the MongoDB Feedback Engine.