mongodb - Designing a database for querying by dates? -
for example, need query last 6 months earliest instance each day (and last day earliest instances in each hours, , last day minutes). thinking of using mongodb , having nested structure like year:{ month:{ day: { hour: { minute: [array of seconds] but first instance have sort array costly. there easier way? would better have date field. and query like: find(date: {$gt : 'starting_date', $lt : 'ending_date'})