In this exercise, you’ll export the mongo shell version of your SQL aggregate query to the Aggregation Editor, where you’ll review the components that make up the aggregate pipeline. You’ll then run the query and view the results.
Studio 3T automatically converts your SQL statement to the selected language, as shown in the following figure.
The mongo shell code includes the
aggregate method, which is called on the
welsh_pubs collection object.
$sort operators are passed in as arguments to the
Each operator carries out a specific task in the aggregate pipeline. If you were to run this code in IntelliShell, you should get the same results as running the original SQL statement.
3. At the top of the Query Code tab, click the Open query in Aggregation Editor button ().
This launches the Aggregation Editor in its own tab in the main window.
The Aggregation tab shows the aggregate query imported from the SQL tab, with the query broken down into three individual stages, as shown in the following figure.
Like the SQL tab, the Aggregation tab is separated into two sections.
The Pipeline flow section shows the components that make up the aggregate pipeline, separated into multiple tabs:
The bottom section is the Pipeline output section, where you can view the output of the full pipeline.
Studio 3T runs the aggregate query and displays the results in the Full Pipeline tab in the bottom section, as shown in the following figure.