Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumMongoDBaggregation $match $groupSingle-choice MCQ

Given this pipeline on a collection where `tags` is an array field, how many documents will the `$group` stage emit and what does `_id: null` produce?

db.posts.aggregate([ { $match: { published: true } }, { $group: { _id: null, total: { $sum: 1 }, allTags: { $addToSet: "$tags" } } } ])