Mongodb Subdocument Date Range Returns Wrong Results
first time in Stackoverflow. I'm trying to run a date range query on an array collection but Mongo Shell returning irrelevant documents witch doesn't match my criteria. It doesn't matter i'm doing the query trough PHP drivers, Doctrine Mongodb Query-builder or Mongo Shell. Here is my query: db.deals.find( { "total_sold.created_at": { $gt: new ISODate("2014-03-05T00:00:00Z"), $lt: new ISODate("2014-03-05T23:59:00Z") } }).limit(1).pretty() And here is the result: { "_id" : "1241412fb99a11a0bc70032a2cb6059b", "total_sold" : [ { "some_field": "value", "created_at" : ISODate("2014-02-13T15:48:35Z")