Question: Apart from using a mapreduce pipeline to write complex queries in MongoDB, it also provides an aggregate command through which you can define an aggregation
Apart from using a map–reduce pipeline to write complex queries in MongoDB, it also provides an “aggregate” command through which you can define an aggregation pipeline consisting of several stages (filtering, limiting, grouping, and sorting), as we’ve discussed in the chapter. Would it be possible to write the following query:

also as an “aggregate” command instead of using a map–reduce pipeline? For which types of queries would aggregation become harder in MongoDB?
SELECT genre, SUM(nrPages) FROM books GROUP BY genre ORDER BY genre
Step by Step Solution
3.39 Rating (161 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
