Filtering using specific date range


Hi,
I have a datas like this in the database. I need to query the datas between start and end of the specific month.

I have used python and write the code as below,

            start_of_month = datetime.datetime(year, month, 1, 0, 0, 0)
            last_day_number = calendar.monthrange(year, month)[1]
            last_of_month = datetime.datetime(year, month, last_day_number)

           for finding query => {"date": {"$gte": start_of_month, "$lt": end_of_month}}

This code is not working properly. could you help me out?

Most likely you have a problem because your field date is stored as a string while you querying with a datetime value.