MongoDB database data can be queried can be queried in different ways to get the data you want and in the required format.
When there is a need for something like
it is the Aggregation query. With aggregation query, the collection’s documents are processed through stages (together called as pipeline) to get the desired output.
For example, in this case, (1) it is grouping by people and counting, (2) matching (the count is at least 3), and finally, (3) projecting the required fields (reviewer ID, reviewer name, and the number of reviews).
The aggregation pipeline stages in this case are:
$match and the
$addFields). Aggregation Pipeline Quick Reference has links to the stages and examples.
Also, MongoDB Compass GUI tool has this Aggregation TAB, where one can build the query using GUI (like list boxes and buttons). A nice feature with this is as you build each stage, you can see the transformed data at that stage in an adjacent window (and it will be input to the next stage in the pipeline).