I was trying to query from mongodb using php, my database looks like this
{
"_id" : ObjectId("55892817d4302e281b8b4567"),
"subject" : "Report",
"createdAt" : ISODate("2015-06-23T09:34:15Z"),
"processedAt" : ISODate("2015-07-23T09:34:15Z"),
"testNumber" : 10
}
and my query is:
$procInMins = 60;
$anchor = new \DateTime('now', new \DateTimeZone('UTC')); // now
$anchor->sub(new \DateInterval('PT' . $procInMins . 'M'));
$query = array( "subject" => "Report", "processedAt" => array( '$gt' => $anchor));
$cursor = $collection->find($query);
and this returns a cursor whose count is 0, but i also tried
$query = array( "subject" => "ProcessOverflowSmsLogCommandTest Report", "testNumber" => array('$gt'=>3) );
in this case i compare the testNumber field and it returns 1 result, which is correct. So i think there's something wrong with the date, but I have no idea how to fix this. Thanks