Hi,
Your query seams good.
Can you check in the database if createdAt
properties are added to the documents?
Also, you can actually do the sorting with _id
if it’s of the type ObjectId:
Model.find().sort({ _id: -1 })
Hi,
Your query seams good.
Can you check in the database if createdAt
properties are added to the documents?
Also, you can actually do the sorting with _id
if it’s of the type ObjectId:
Model.find().sort({ _id: -1 })