mongoDB search query for "dd/mm/yyyy" string data

I hold dates like 'dd/mm/yyyy' in MongoDB. I want to write a query that returns data between two dates.

I found querys but they are for ISO date or Unix Timestamp.

I wrote a query below, but it doesn't work healthy

                            "$and": [
                                {"$or":[  {  "costs.costDate": {
                                        $lte: '01/04/2021',
                                        $gte: '01/01/2021'
                                { "employeeID": ObjectId("5ecff6b94ad3ab741126034f")}

Example data:

"employeeId" : 1
"costs" : {
"costDate" : "01/4/2021"

Read more here:

Content Attribution

This content was originally published by Olcay at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: