Ad Code

Responsive Advertisement

✨ MongoDB - Aggregators

 Aggregation Framework in MongoDB



$sort

Description: Sorts documents in ascending (1) or descending (-1) order.

Syntax: { $sort: { <field1>: <sort order>, ... } }

Example:

db.collection.aggregate([
  { $sort: { age: -1 } }
])

Post a Comment

0 Comments