J
J
JRazor2016-04-15 17:44:02
Python
JRazor, 2016-04-15 17:44:02

Pymongo: how to sort by today's date only?

The database stores 'datetime' values ​​and they do indeed store datetime :

datetime(2016, 04, 15, 19, 45)
datetime(2016, 04, 15, 20, 00)
datetime(2016, 04, 15, 22, 30)

I understand how to do filtering in Python:
datetime(2016, 04, 15, 22, 30).date() == date.today()

But how to sort by Mongo does not occur to me.
Thank you all for your attention and replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2016-04-15
@k12th

Select dates greater than or equal to 04/15/2016T00:00:00 and less than 04/16/2016T00:00:00.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question