title: Mongoose query by date
body: <p>I want to query mongoDB with document structure like this:</p>
  
  <pre><code>var ExampleSchema = mongoose.Schema({
      createdAt: { type: Date, default: Date.now },
      validUntil: Date,
      name: String
  });
  </code></pre>
  
  <p>and need it to return only valid documents, i.e. where validUntil is greater than current time. This doesn't work, mongoose returns all documents:</p>
  
  <pre><code>var d = new Date();
  var n = d.toISOString();
  Example.find({ '$where': 'validUntil'&gt;n })
  </code></pre>