-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Hi I am using version 3.1.4 and wanted to get all records between month and day range of current date without year.
For example ,I have a Event model
Class Event
include Mongoid::Document
field :name
field :start ,type: Date
field :end ,type: Date
end
I want to get all the records occurring between today without year.
for example I have 6 records in DB
start=>2013-Sep-15 ,end: => 2013-Oct-10
start=>2013-Sep-10 ,end: => 2013-Oct-01
start=>2013-Sep-18 ,end: => 2013-Dec-12
start=>2013-Sep-15 ,end: => 2013-Oct-10
---* not current year
start=>2012-Sep-15 ,end: => 2012-Oct-10
start=>2011-Sep-15 ,end: => 2012-Jan-10
Event.where(:start.lte=>Date.to_day,:end.gte=>Date.to_day) will return first 4 records but rest of two are ignored.
I want to get rest of the records because today(month and day) also matching with month and day of those.
Any idea how i can do that using mongoid?