I am trying to write a mongo query in python to get the monthly and weekly range from days. So far I have
my_collection.find({
'date':{
'$gte': date_start,
'$lte': date_end
}
}
It returns the day range between date_start and date_end, I tried to use '$month': 'gte', 'lte' but is not working, does anyone has any ideas how to get monthly and weekly based on the start date and end? The date_start and date_end are datetime objects.
Example ( date_start = 2017-01-01, date_end = 2017-12-01) I want to return just the month between this two range(start, end): 01, 02, 03, 04, 05, 06 ..
I just went through the same examples that has been asked before and what I asked is different, in my situation I have two dates, start and end.. now from this two dates I just want to display the month by combining the two dates together.. so far I haven't seen an example of how to do it.
Thanks