With the release of MongoChef 4.1.1, we have a made it super-easy to quickly disable stages temporarily in your aggregation query. This often comes in very handy while debugging your aggregation query.
To demonstrate this, let’s consider the following simple aggregation query on the City of Chicago’s publicly available housing database.
Our aggregation pipeline consists of 4 stages:
- Limit the documents that go into the pipeline to just 5
- A projection stage that just keeps the address, zip and type fields
- A match stage that only keeps documents that have “60644” as zip code
- A sort stage that sort the documents in the pipeline based on their (property) type
While designing and debugging my aggregation query, we limited my pipeline to just 5 documents to keep the load on the server as low as possible. Now that we think our query is done, we want to test it for the first time on the entire data set. Since we are not yet entirely convinced that the query does what it is supposed to, we don’t want to get rid of the limit stage just yet. Instead, we’ll just temporarily exclude it from the pipeline. For this, we simply click the stage tab and deselect the “Include in pipeline” option:
When we now run the aggregation query, it will be executed without the (disabled) first stage and we can see that the full result set is returned:
And that’s how easy it is to temporarily disable aggregation stages with MongoChef! And here once again in one fluid motion :-) .