使用 MongoDB\BSON\UTCDateTime 進行查詢時,請確保 strtotime 的實例使用毫秒作為建構函式的參數。
$start = new MongoDB\BSON\UTCDateTime(strtotime("midnight") * 1000);
$filter = ['date' => ['$gte' => $start]];
$options = ['sort' => ['date' => -1]];
$query = new MongoDB\Driver\Query($filter, $options);