I have a creation date attribute of a document which has a format like this: "05/03/2020" of type String.
I must extract all the documents from my system having a creation date before "05/03/2020".
I tried with:
db.MyCollection.find ({DateC: {$lte: "05/03/2020"}})
but it still returns 0.
Is there a way to compare if a date format String is before another date?
Thank you
You can use $dateFromString operator to convert
$DateC
to ISODate,Playground