After upgrading to the new Mongo driver for PHP, I ran into a sorting and query problem.
The old driver used: http://php.net/manual/en/class.mongodate.php , which stores the dates in the MongoDate object in seconds.
New driver: http://php.net/manual/en/class.mongodb-bson-utcdatetime.php saves the date in a different format and saves it in milliseconds.
A request has occurred using $ gte or $ lte useless. Example:
$collection -> find(array('start_date' => array('$gte' => new MongoDate()))); $collection -> find(array('start_date' => array('$gte' => new MongoDB\BSON\UTCDateTime())));
These two do not return the same result. With all the old data, how can I still safely request both MongoDate and UTCDateTime?
source share