I don't seem to be able to get even the most basic date query to work in MongoDB. With a document that looks something like this:
{
"_id" : "foobar/201310",
"ap" : "foobar",
"dt" : ISODate("2013-10-01T00:00:00.000Z"),
"tl" : 375439
}
And a query that looks like this:
{
"dt" : {
"$gte" : {
"$date" : "2013-10-01T00:00:00.000Z"
}
}
}
I get 0 results from executing:
db.mycollection.find({
"dt" : { "$gte" : { "$date" : "2013-10-01T00:00:00.000Z"}}
})
Any idea why this doesn't work?
For reference, this query is being produced by Spring's MongoTemplate so I don't have direct control over the query that is ultimately sent to MongoDB.
(P.S.)
> db.version()
2.4.7
Thanks!
Query
object in Spring. The serialized form of the query is not necessarily a valid query that you can just copy/paste into a mongo shell, which in itself is kind of frustrating. The culprit is here: grepcode.com/file/repo1.maven.org/maven2/org.mongodb/… – Arapaima