The MongoDB Compass tool, introduced in Chapter 1, Introducing MongoDB, has an extremely useful feature which assists you in developing complex aggregation pipeline queries. To use Compass to build an aggregation pipeline query, you first need to start Compass and connect to MongoDB. You will then need to select the database and collection upon which you wish to perform an aggregation.
In the following example, we select the sweetscomplete database and the purchases collection. From the horizontal menu, we then select Aggregations. Here is how the screen appears so far:
We then turn our attention to the dialog box in the bottom left. Clicking on Select, we add our first stage, $match. You can then start typing the start of the desired expression. The following tables summarizes possible initial actions:
If You Type .... |