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 .