Introducing the Aggregation Stage Wizard in MongoDB Compass
Have you ever wanted to create an aggregation but not known where to start? We’ve got a solution for you! MongoDB just released a new feature that can help as part of our powerful aggregation experience in Compass . Starting in version 1.38, Compass’ new Aggregation Stage Wizard will help you jumpstart aggregation development by allowing you to craft aggregation stages based on your use case. Getting started with an aggregation stage is often the hardest part. Although Compass provides a variety of editors for writing aggregations, you previously needed prior experience with MongoDB Query API syntax to get started. Otherwise, you had to rely on documentation or code examples to guide you through the process. The Aggregation Stage Wizard addresses this common challenge. Once you know what you’d like to accomplish with your aggregation stage, you can click the Wizard icon and drag the corresponding use case to your pipeline. The Aggregation Stage Wizard then converts your use case into an aggregation stage. From there, you can enter the appropriate fields, values, and operators through a series of dropdowns and text boxes–no need to agonize over quotations and curly braces! The Aggregation Stage Wizard will convert your entries into a valid aggregation stage written in MongoDB’s Query API syntax. From there, you can feel free to expand on your aggregation stage with the foundation set by the Aggregation Stage Wizard. In using the Aggregation Stage Wizard, you’ll naturally and interactively learn how to develop aggregation stages so that pretty soon, working directly in Query API syntax will be second-nature for you. To use the Aggregation Stage Wizard, please be sure to download the latest version of Compass . We also value your continued feedback. If you have any feedback about the Aggregation Stage Wizard, new use cases you’d like to see supported, or ideas for improving Compass more generally, please submit your feedback . We’re continually improving Compass. Keep watching our blog for the latest updates!
Boosting Developer Productivity with MongoDB Compass Settings
If you’re a developer who loves working with GUIs, you have probably used MongoDB Compass , MongoDB’s official GUI, to view and manage your data, build aggregation pipelines, and more. We’re always adding and improving Compass features to better support your experience. In line with this, we recently added highly-requested settings to Compass to enable more customization and boost developer productivity . In this blog, we’ll be running through the settings that are most helpful to leverage depending on your use case. One-and-done settings The settings modal is the central location where you can manage the majority of your Compass settings. The settings here are ones that you can quickly enable and leave on unless your preferences change later on. If you’re a Mac user, you can open the settings modal using the ⌘, shortcut or by navigating to “MongoDB Compass” -> “Settings”. If you’re a Windows user, you can use the Ctrl + , shortcut or navigate to “Connect” -> “Settings”. Dark theme Prior to its release, dark mode was the feature customers requested the most for Compass on our product feedback forum . We’re excited to have delivered this feature last year by adding a dark theme in Compass and the option to sync your Compass theme with your OS settings under the theme tab under “Settings.” More recently, we’ve updated our dark theme to have clearer contrast and look and feel more modern. Dark theme should additionally help preserve your battery life and reduce visual strain. Feature preview Under “ Feature Preview ,” you can enable new features of Compass before they’re generally available. Enabling the settings listed here can be a great way to try out helpful and sleek features early on. If you have feedback on any of the features here or additional requests, you can submit them in our feedback forum . General settings Other global settings can be found under “ General .” Consider a scenario where you’re working with production data. Your workflow could work like this: You may not want to accidentally write to the database, so you can enable “Set Read-Only Mode” to restrict yourself to read operations for the time being. After noticing a bug in production, you search for a single document on a large collection in the Documents tab. Before running the query, you may want to reduce the maximum query time to be less than the default 60 seconds to reduce risk on this production workload. If this is a one-off query, you can set MaxTimeMS under “More Options” in the query bar for this query. The MaxTimeMS that you set will be in effect until you reset the query bar. If you envision that you’ll run other complex queries later, you can set the “Upper Limit for maxTimeMS for Compass Database Operations” in the settings modal. If you want to see other settings that you can leverage, we recommend that you check out “General” and “Privacy” in the settings modal. Customizing Compass for your use case Now that we’ve looked at how to optimize settings that apply across the full Compass experience, let’s look at how you can adjust other more specific settings in the course of your daily workflows. In the Documents tab, there are three options for viewing your data: the default list view, JSON view, and table view. Depending on your previous database experience and the task that you’re working on, you may prefer some of these views to others: When you’re developing your application, the default list view can be helpful for referencing your schema and getting a mental model of your data. When you want to find a specific document for debugging purposes, the default list and JSON views are helpful. They allow you to easily see all of the fields available in a document. If you want to view or edit data types, the default list view is most useful. If you’re looking to make a quick edit and don’t want to worry about setting data types, you can use the JSON view. These views are also helpful for checking out nested values and elements. If you’re used to working with relational databases or want to scan more documents, the table view can be handy. Once you have selected your view of choice, you may want to search results or compare data from different collections. To do this, you can open the respective collection in a new tab. Similarly, if you want to open another MongoDB environment without closing the one that you have open, you can open a new Compass window using the ⌘N shortcut on Mac and Ctrl + N on Windows. This can be helpful when you want to view the same document(s) or test queries across your local/debugging, staging, and production environments. To adjust the size of content, you can use the ⌘= and ⌘- accessibility shortcuts for zoom in and zoom out on Mac respectively, or Ctrl + = and Ctrl + - on Windows. Other Compass shortcuts can be found in our documentation here . Aggregation settings There are aggregation-specific settings that you can leverage when you’re building pipelines in the Aggregations tab: If you’re familiar with aggregation syntax and don’t want to see helper text when adding new stages to your pipeline, you can disable comment mode. If you want to see more than 10 documents in the preview of documents, you can set the number of documents shown in the preview to a higher count. Let’s say that you’re building a long and complex aggregation and want to reduce the amount of time that it takes to preview the results of the pipeline that you’re building. You can reduce the number of documents sampled for the document preview. Note that this setting is only applied for the document preview and is not applied when the pipeline is run. What's next? We hope the info in this blog helps you get even more out of your experience with MongoDB Compass. We’re continually improving our Compass settings experience - if you have any Compass settings or other Compass feature requests, you can submit them in our feedback portal .
MongoDB Releases “Focus Mode” in Compass GUI
We’re excited to announce an improvement to the aggregation-building experience in MongoDB Compass. Compass already makes it easy to view and manage your MongoDB databases, and with the addition of Focus Mode you now have the option to dial in on specific stages within your aggregation pipeline. Overview MongoDB's Query API and Aggregation Pipelines enable easy retrieval and processing of data from collections. They also facilitate complex operations such as filtering, grouping, and transforming, making computation and analysis effortless. MongoDB Compass' intuitive interface simplifies the process of building aggregations by enabling developers to easily create, test, and refine aggregation pipelines, and the introduction of Focus Mode takes this a step further. When constructing pipelines, having to simultaneously view and consider multiple stages can make it challenging to analyze the impact of a specific stage, leading to increased cognitive load. Now, developers can toggle Focus Mode on stages, opening a view that focuses exclusively on the contents of the specific stage they are working on. This view can also be used to view sample input (before the aggregation stage is applied) and output (after the stage is applied) documents, aiding in the understanding, troubleshooting, and optimizing of the data pipeline. Developers can also switch between different stages by accessing a drop-down menu at the top of their screen. This makes identifying inefficiencies and optimizing performance easier, as well as providing deeper insights from the output documents for data-driven decision making. Focus Mode offers a streamlined and distraction-free environment for working with stages, improving the efficiency and precision of testing, debugging, and analyzing the impact of each stage on the data, ultimately simplifying the creation and management of pipelines. Conclusion The addition of Focus Mode is part of our continued refresh of the query and aggregation experience in Compass. These improvements are made possible thanks to the feedback of our developer community, so we encourage you to try out this new feature and let us know what you think! To learn more about Aggregation Pipeline Builder in Compass, visit our documentation .
New Aggregation Pipeline Text Editor Debuts in MongoDB Compass
There’s a reason why Compass is one of MongoDB’s most-loved developer tools: because it provides an approachable and powerful visual user interface for interacting with data on MongoDB. As part of this, Compass’s Aggregation Pipeline Builder abstracts away the finer points of MongoDB’s Query API syntax and provides a guided experience for developing complex queries. But what about when you want less rather than more abstraction? That’s where our new Aggregation Pipeline Text Editor comes in. Recently released on Compass, the Aggregation Pipeline Text Editor allows users to write free-form aggregations. While users could previously write and edit pipelines through a guided and structured builder organized by aggregation stage, a text-based builder can be preferable for some users. This new pipeline editor makes it easy for users to: See the entire pipeline without having to excessively scroll through the UI Stay “in the flow” when writing aggregations if they are already familiar with MongoDB’s Query API syntax Copy and paste aggregations built elsewhere (like in MongoDB’s VS Code Extension ) into Compass Use built-in syntax formatting to make pipeline text “pretty” before copying it over from Compass to other tools The Aggregation Pipeline Text Editor in Compass. Notice how toward the top right you can click on “stages” to move back to the traditional stage-based Aggregation Pipeline Builder. Ultimately, the addition of the Aggregation Pipeline Text Editor to Compass gives users more flexibility depending on how they want to build aggregations. For a more guided experience and to get result previews when adding each new stage, the existing Aggregation Pipeline Builder will work best for most users. But when writing free-form aggregations or copying and pasting aggregation text from other tools, the Aggregation Pipeline Text Editor may be preferable. It also previews the final pipeline output, rather than the stage-by-stage preview that exists today. Users will be able to access either both the traditional Aggregation Pipeline Builder and the new Pipeline Text Editor from directly within the Aggregations tab in Compass and can switch between the two views without losing their work. To get access to the new Aggregation Pipeline Text Editor, make sure to download the latest version of Compass here . And as always, we welcome your continued feedback on how to improve Compass. If you have ideas for how to improve your experience with Compass you can submit them on our UserVoice platform here . We’ll have even more great features coming in Compass soon. Keep checking back on our blog for the latest news!
Ruby Added to MongoDB Export to Language for Compass and VS Code
Thousands of developers rely on Compass as a GUI or VS Code as an integrated development environment to query their data in MongoDB. With both Compass and the official MongoDB Extension for VS Code, you can build a query or aggregation using the MongoDB Query API and export it to your chosen programming language. The only limitation? Until now, only four languages have been supported for this feature in both tools: Java, Node.js, C#, and Python. Those four languages cover a significant percentage of the MongoDB developer community, but we knew we wanted to expand to help even more developers export queries/aggregations to their programming language of choice. To this end, we’re pleased to announce that the Export to Language features in both Compass and the VS Code Extension for MongoDB now support exporting to Ruby. To build a query/aggregation in VS Code and export to Ruby, connect to your cluster in VS Code, create a Playground with code that draws on the Query API, and highlight your Query API syntax. From there, you will see a lightbulb icon that gives you the option to export to Ruby, among other languages. You also have the option to export a sample query/aggregation including details on the driver usage so you start with a fully functional code snippet. To build a query/aggregation in Compass and export to Ruby, simply connect to your cluster from Compass, navigate to the “Aggregations” tab, build your query/aggregation, and then click the button with an export icon immediately to the right of the “Save” button. Once you’ve followed the above steps in VS Code or Compass, you’re ready to use the exported code in your Ruby app! For a peek under the hood at how MongoDB’s engineers added Ruby to Compass, check out this great article on Dev.to by Rachelle Palmer , Product Lead for Developer Experience at MongoDB. We hope all the hardcore Rubyists out there find this new feature useful and that it makes it even easier to build Ruby apps with MongoDB. As you continue to use these tools within your application development cycle, don’t hesitate to reach out and give us feedback .
Improved Experience for Saved Aggregations and Queries in MongoDB Compass
Tens of thousands of MongoDB users take advantage of MongoDB Compass to query their data and build sophisticated aggregation pipelines. As an easy-to-use GUI, Compass lets you seamlessly connect to and interact with your data, including using our powerful Query API. You just connect to your cluster, navigate to your chosen database and collection, and start building your queries. Many Compass users want to come back again and again to their best queries — or make a query repeatedly available to all database users — but the experience of working with saved queries and aggregations has created some challenges for users in the past. Previously, saved aggregations and queries were bound to a specific database and collection, making it harder to integrate those saved queries and aggregations into the standard software-development lifecycle. If, for example, you built an aggregation pipeline against a staging database and saved it, you’d still have to build that same pipeline again if you wanted to use it for your production database. Users have also reported difficulty finding their favorites after saving them. That’s why we’ve released a new-and-improved experience for saved aggregations and queries in MongoDB Compass. It includes a new “My Queries” screen you can navigate to from the left sidebar or from a tab at the top, next to the “Database” and “Performance” tabs. Once on the “My Queries” screen, you can search across all your saved queries/aggregations and sort or filter by database or collection. And you can apply your saved queries/aggregations across namespaces. To learn more about working with queries and aggregations in Compass, visit our documentation on the Aggregation Pipeline Builder or queries . We’re confident this new experience will make it easier than ever to build, save, and reuse your favorite aggregations and queries, and ultimately remove friction with integrating them into the application development process. Head over to your Compass instance and check it out. (If you’re not yet a Compass user, you can download it for free .) Happy querying!
Introducing the Aggregation Pipeline Builder in MongoDB Compass
MongoDB Compass 1.14, including the aggregation pipeline builder, was released for general availability on June 26, 2018. Get Compass 1.14 from the Download Center . Building MongoDB aggregations has never been so easy. The most efficient way to analyze your data is where it already lives. That’s why we have MongoDB’s built-in aggregation framework . Have you tried it yet? If so, you know that it’s one of the most powerful MongoDB tools at your disposal. If not, you’re missing out on the ability to query your data in incredibly powerful ways. In fact, we like to say that “aggregate is the new find”. Built on the concept of data processing pipelines (like in Unix or PowerShell), the aggregation framework lets users “funnel” their documents through a multi-stage pipeline that filters, transforms, sorts, computes, aggregates your data, and more. The aggregation framework enables you to perform extensive analytics and statistical analysis in real time and generate pre-aggregated reports for dashboarding. There are no limits to the number of stages an aggregation pipeline can have – pipelines can be as simple or as complex as you wish. In fact, the only limit is one’s imagination when it comes to deciding how to aggregate data. We’ve seen some very comprehensive pipelines! With a rich library of over 25 stages and 100 operators (and growing with every release), the aggregation framework is an amazingly versatile tool. To help you be even more successful with it, we decided to build an aggregation construction user interface. The new Aggregation Pipeline Builder is now available with the latest release of Compass for beta testing. It’s available under the Aggregations tab. The screenshot below depicts a sample pipeline on a movies collection that produces a listing of the title, year, and rating of all movies except for crime or horror, in English and Japanese which are rated either PG or G, starting with most recent, and sorted alphabetically within each year. Each stage was added gradually, with an ability to preview the result of our aggregation. This easy-to-use UI lets you build your aggregation queries faster than ever before. There’s no need to worry about bracket matching, reordering stages, or remembering operator syntax with its intuitive drag-and-drop experience and code skeletons. You also get auto-completion for aggregation operators as well as query operators and even document field names. If you need help understanding a particular operator, click on the info icon next to it and you’ll be taken directly to the appropriate guidance. As you are building your pipeline, you can easily preview your results. This, in combination with an ability to rearrange and toggle stages on and off, makes it easy to troubleshoot your pipelines. When you are satisfied with the results, the constructed pipeline can be copied to the clipboard for easy pasting in your code, or simply saved in your favorites list for re-use later! The aggregation authoring experience just got even more incredible with the new Compass aggregation pipeline builder. Why not check it out today? Download the latest beta version of Compass See the documentation for the aggregation pipeline builder in Compass See the aggregation framework quick reference To learn or brush up your aggregation framework skills, take M121 from our MongoDB University – it’s well worth it! Also, please remember to send us your feedback by filing JIRA tickets or emailing it to: email@example.com .