title: Doing range queries in Mongoose for Hour / Day / Month/ Year
body: <p>Trying to figure out how to do this. Basically I want to sort by Hour / Day / Month / Year of my submissions.</p>
  
  <p>Each <code>submission</code> has a <code>created</code> field which contains a Mongoose Date object in the form of <code>"created" : ISODate("2013-03-11T01:49:09.421Z")</code>. Do I need to compare against this in the find() conditions?</p>
  
  <p>Here is my current query (I'm wrapping it in a count for pagination purposes FWIW so just ignore that part):</p>
  
  <pre><code>  getSubmissionCount({}, function(count) {
  
    // Sort by the range
      switch (range) {
        case 'today':
          range = now.getTime();
        case 'week':
          range = now.getTime() - 7;
        case 'month':
          range = now.getTime() - 31; // TODO: make this find the current month and # of   days in it
        case 'year':
          range = now.getTime() - 365;
        case 'default':
          range = now.getTime();
      }
  
      Submission.find({
        }).skip(skip)
           .sort('score', 'descending')
           .sort('created', 'descending')
           .limit(limit)
           .execFind(function(err, submissions) {
              if (err) {
            callback(err);
          }
  
          if (submissions) {
            callback(null, submissions, count);
          }
      });
    });
  </code></pre>
  
  <p>Can someone help me figure this out? With that current code it just gives me all submissions regardless of a time range, so I'm obviously not doing something properly</p>