i trying query mongodb using php, database looks this
{ "_id" : objectid("55892817d4302e281b8b4567"), "subject" : "report", "createdat" : isodate("2015-06-23t09:34:15z"), "processedat" : isodate("2015-07-23t09:34:15z"), "testnumber" : 10 } and query is:
$procinmins = 60; $anchor = new \datetime('now', new \datetimezone('utc')); // $anchor->sub(new \dateinterval('pt' . $procinmins . 'm')); $query = array( "subject" => "report", "processedat" => array( '$gt' => $anchor)); $cursor = $collection->find($query); and returns cursor count 0, tried
$query = array( "subject" => "processoverflowsmslogcommandtest report", "testnumber" => array('$gt'=>3) ); in case compare testnumber field , returns 1 result, correct. think there's wrong date, have no idea how fix this. thanks
Comments
Post a Comment