0

I have a model:

var model = {
      created: { type: Date, default: Date.now }
    , data: { }
}

...but I cannot seem to select based on a date as per the guides I'm using. Here's what I'm trying:

Model.find({
    created: { $lte: new Date('2012-03-16T20:54:35.630Z') }
}).run(function(err, models) {
    // ...
});

I'm wondering if Mongoose has changed again... or if I'm just doing it wrong?

Eric Martindale
  • 1,106
  • 1
  • 13
  • 26

2 Answers2

6

What you have looks ok. Here is a working example.

Are you getting error or just no results?

Another great place to get help is on the official forum here.

aaronheckmann
  • 10,625
  • 2
  • 40
  • 30
0

Try changing to ... .exec(function(err, ... instead.

Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145
German Blanco
  • 816
  • 6
  • 9