Skip to main content

One doc tagged with "sort"

View All Tags

$sort

The $sort stage in MongoDB's aggregation pipeline is used to sort the documents based on one or more fields. Sorting can be done in ascending or descending order, and it's often used in conjunction with other aggregation stages like $group, $match, and $project to organize the output.