Answers for "how to sort a collection by date in mongodb?"

5

mongodb date sort

db.products.find().sort({"created_at": 1}) --- 1 for asc and -1 for desc
Posted by: Guest on July-01-2021

Code answers related to "how to sort a collection by date in mongodb?"

Browse Popular Code Answers by Language