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

In a `$group` stage, what is the difference in result between using `$first` as an accumulator versus `$min` on the same numeric field, assuming no preceding `$sort`?

db.events.aggregate([ { $group: { _id: "$userId", firstVal: { $first: "$score" }, minVal: { $min: "$score" } } } ])