Between with dates


How do I do a between with dates?


Its so simple, just use $gte and $lte operator for a between clause like this:
Note: The date you specify should be in ISODate format.

"Datefield": { 
              $gte: <betweenFromDate>,
              $lte: <betweenToDate>

So, now you can use this option to filter date column with your needs. Good luck.

Thanks for your answer.

I should have been more specific. Can I write a query without hours?
or It always must have hour.

Thank you

You should specify the date in ISOdate format … since in collection when you are specifying date fields we use new Date () function. So mostly the date is stored in above format as I told.
But, I don’t know how you created your collection.


So,I’ll try with examples with ISOdate. Thanks.