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

Using $group with an accumulator, what does $first return, and what is the prerequisite for it to be meaningful?

db.events.aggregate([ { $sort: { ts: 1 } }, { $group: { _id: "$userId", firstEvent: { $first: "$type" } } } ])