My expiry field in mongodb is stored as string in format "11 Dec 2021"
So each collection look like this
{
field1: "Some data"
expiry: "11 Dec 2021"
}
I need all collections whose expiry is greater than Dec 31, 2021
If the expiry is of type Date, I can use something like below.
db.collection.find({expiry: {$gt: new Date("31 Dec 2021")}});
But since my expiry is of type String how do I use it? I can do a Array.filter of results but thats not what I am looking for.