Ok, been banging my head against this for a while and having no luck
figuring out the logical way to do this (other than installing
ElasticSearch - which I'll be doing in the near future).
I have records that have startDate and endDate ranges. I want to query
the view based on today's date. Say I have a record that has a start
date of 1/31/2011 and an end date of 2/13/2011 and I want to find out
which records fall within today's date.
In other words
1/31/2011 < 2/6/2011 < 2/13/2011
How in the world do I do that? I've been trying something like this:
var startDate = new Date(doc.startDate);
var endDate = new Date(doc.endDate);
var startYear = startDate.getFullYear();
var startMonth = startDate.getMonth();
var startDay = startDate.getDate();
var endYear = endDate.getFullYear();
var endMonth = endDate.getMonth();
var endDay = endDate.getDate();
emit([
startYear,
startMonth,
startDay,
endYear,
endMonth,
endDay
]);
But as soon as I add in the endYear variable it goes wonky and starts
returning records that don't match at all. Any help is greatly
appreciated.
-warner