Explore Developer Center's New Chatbot! MongoDB AI Chatbot can be accessed at the top of your navigation to answer all your MongoDB questions.

Join us at AWS re:Invent 2024! Learn how to use MongoDB for AI use cases.
MongoDB Developer
Compass
plus
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right
Productschevron-right
Compasschevron-right

A Better MongoDB Aggregation Experience Via Compass

Rachelle Palmer3 min read • Published Jun 21, 2022 • Updated Jul 12, 2024
Compass
Facebook Icontwitter iconlinkedin icon
Rate this announcement
star-empty
star-empty
star-empty
star-empty
star-empty
MongoDB Compass has had an aggregation pipeline builder since 2018. Its primary focus has always been enabling developers to quickly prototype and troubleshoot aggregations. Aggregations would then be exported to the developer’s preferred programming language and copy-pasted inside application code.
As of MongoDB World 2022, we are relaunching the aggregation experience within Compass, and we’re happy to announce richer, more powerful functionality for developers.
Compass 1.32.x series includes the following: In-Use encryption, including providing options for KMS details in the connection form and CRUD support for encrypted collections, and more specifically for Queryable Encryption when creating collections Saved queries and aggregations in the My Queries tab Explain plan for aggregations Run aggregations against the whole collection Export aggregation results
Below, we will talk a bit more about each of these features and how they are useful to developers.

In-Use Encryption

Our latest release of MongoDB Compass provides options for using KMS details in the connection form, as well as CRUD support for encrypted collections. Specifically, we also include functionality for Queryable Encryption when creating a collection.

My Queries Section

Users can already save aggregations in Compass for later use.
However, saved aggregations are bound to a namespace and what we’ve seen often is that our users had trouble finding again the queries and aggregations they’ve saved and reuse them across namespaces. We decided the experience had to be improved: developers often reuse code they’ve written in the past as a starting point for new code. Similarly, they’ve told us that the queries and aggregations they saved are their “best queries”, the ones they want to use as the basis to build new ones.
We took their input seriously and recently we added a new “My Queries” screen to Compass. Now, you can find all your queries and aggregations in one place, you can filter them by namespace and search across all of them.

Explain Plan for Aggregations

When building aggregations for collections with more than a few hundreds documents, performance best practices start to become important.
“Explain Plan” is the most reliable way to understand the performance of an aggregation and ensure it’s using the right indexes, so it was not surprising to see a feature request for explaining aggregations quickly rising up to be in the top five requests in our feedback portal.
Now “Explain Plan” is finally available and built into the aggregation-building experience: with just one click you can dig into the performance metrics for your aggregations, monitor the execution time, and double-check that the right indexes are in place.
However, the role of a developer in a modern engineering team is expanding to include tasks related to gathering users and product insights from live data (what we sometimes refer to as real-time analytics) and generating reports for other functions in the team or in the company.
When this happens, users are puzzled about not having the ability to run the aggregations they have created on the full dataset and export results in the same way they can do with a query. This is understandable and it’s reasonable that they assume this to be table-stakes functionality in a database GUI.
Now this is finally possible. Once you are done building your aggregation, you can just click “Run” and wait for the results to appear. You can also export them as JSON or CSV, which is something really useful when you need to share the insights you’ve extracted with other parts of the business.

Summary of Compass 1.32 release

In summary, the latest version of MongoDB Compass means that users of MongoDB that are exploring the aggregation framework can get started more easily and build their first aggregations in no time without reading a lot of documentation. Experts and established users will be able to get more out of the aggregation framework by creating and reuse aggregations more effectively, including sharing them with teammates, confirming their performance, and running the aggregation via Compass directly.
If you're interested in trying Compass, download for free here.

Facebook Icontwitter iconlinkedin icon
Rate this announcement
star-empty
star-empty
star-empty
star-empty
star-empty
Table of Contents