Challenge 1: Unwind a Tags Array — Possible Solution ==================================================================== db.articles.aggregate([ { $unwind: "$tags" }, { $group: { _id: "$tags", article_count: { $sum: 1 } } }, { $sort: { article_count: -1 } } ]) WHY THIS WORKS AS AN ANSWER ------------------------------ $unwind: "$tags" runs first. An article with tags: ["mongodb", "database", "nosql"] becomes THREE separate documents in the pipeline — one with tags: "mongodb", one with tags: "database", one with tags: "nosql" — each otherwise identical to the original article. Only after that unwind does $group make sense: it groups by _id: "$tags", which now refers to a single tag STRING per document (not an array), since $unwind already flattened it. { $sum: 1 } counts how many of those per-tag documents exist for each tag — equivalent to counting how many articles used that tag, since each article contributed exactly one document per tag it had. The order matters: grouping by "$tags" BEFORE unwinding would try to group by the whole array as a single value, so two articles with the exact same three tags in the exact same order would group together, but "mongodb" alone would never be counted as its own key.