views:

12

answers:

0

It is strange that if in the model:

def SomeClass
  some_date: Time
end

then

SomeClass.where({:some_date.gte => '2010-09-01'}) 

would work well, but when it is

def SomeClass
  some_date: DateTime
end

(change Time to DateTime) then the query won't work? (will get 0 items back).

In the MongoDB shell, they both show up as

> db.analytics.findOne().date
"Fri Sep 10 2010 12:00:00 GMT-0700 (PDT)"

and doesn't make a difference.

Update: actually, one class works with Time, and the other one didn't work with DateTime, but even if that class's date is changed to Time, it still doesn't work. It needs to be conditions = {:date.gte => Time.parse(start_date)} but I wonder why the first class worked?