Sorting data based on date in descending order

if i sort data using date i need to get current date in first order, but if i update date of previous month i get this data in first position instead of current date

Please read Formatting code and log snippets in posts and post sample documents and sample results for your use-case.

Also post what you have tried so far and indicates how it fails to deliver expected results. This will save us time by preventing us to pursue and investigate in a direction you already know does not work.

1 Like

Then imho you should have 2 date fields, like this:

{
date:"...",
lastUpdated: " ",
}

When the doc is created date and lastUpdated are the same number. If you update, you update the lastUpdated field, and you always sort based on lastUpdated.