31 Jan 2013, 14:34
Generic-user-small

Tim Holmes (2 posts)

db.towns.find( { last_census : { $lte : ISODate(‘2008-31-01’) } }, { _id : 0, name: 1 } )

This doesn’t work for me unless I change it to

db.towns.find( { last_census : { $lte : ISODate(‘2008-01-31’) } }, { _id : 0, name: 1 } )

Either a typo or a US/European regional thing?

At the mongo shell:

ISODate(‘2008-01-31’) => ISODate(“2008-01-31T00:00:00Z”) ISODate(‘2008-31-01’) => ISODate(“2010-07-01T00:00:00Z”)

(Version 2.0 of the book)

  You must be logged in to comment