2016-06-14 33 views
0

で働いていない私は、時間
MongoDBのISODate形式の比較はPHP

$from=$start = new MongoDate(strtotime('2016-04-11 00:00:00')); 
$to=new MongoDate(strtotime('2016-06-18 00:00:00')); 
$filterpatient = array("order.patientinfo.order_id" => $ordertext,"order.orderitem.estdate" => array('$gte' =>$from, '$lte' => $to)); 
$cursor = $collection->find($filterpatient)->sort(array('_id'=>-1)); 

を照会するには、次のPHPコードを書いています。しかし、これは何の結果を与えていない"estdate" : "2016-06-14T06:49:00.000Z"
のようなMongoDBのレコードを持っています。

答えて

0

mongodbドライバを使用している場合は、これが役に立ちます。

$ starttime = strtotime( "2016-04-11 00:00:00"); $ utcstartdatetime =新しいMongoDB \ BSON \ UTCDateTime($ starttime);

今度は、クエリに$ utcstartdatetimeを使用してください。