The problem that plagued me for a day. The first is the Mongodb replica set. Check the php Mongo extension manual to complete the replica set. Then there is a long integer problem. The timestamp of the Long Integer type stored in mongo is java. Php is a weak language with 11 timestamps. Currently, it is still in the 10-bit phase. The timestamp converted to java must be followed by zero. Generate ja
The problem that plagued me for a day. The first is the Mongodb replica set. Check the php Mongo extension manual to complete the replica set. Then there is a long integer problem. The timestamp of the Long Integer type stored in mongo is java. Php is a weak language with 11 timestamps. Currently, it is still in the 10-bit phase. The timestamp converted to java must be followed by zero. // Generate ja
The problem that plagued me for a day. The first is the Mongodb replica set. Check the php Mongo extension manual to complete the replica set. Then there is a long integer problem.
The timestamp of the Long Integer type stored in mongo is java. Php is a weak language with 11 timestamps. Currently, it is still in the 10-bit phase. The timestamp converted to java must be followed by zero.
// Generate the java timestamp $ time = (string) $ time. '000'; $ time = (int) $ time;
However, the query results have no data at all. Use Debug to print the query statement of the Framework Mongo. It is okay to directly query the statement in shell. But there is no data.
Then, the Mongo log is opened and adjusted to 5, which records the query statement. Refer to here.
I found that all the time I queried has changed to a negative number:"{$ Gt:-154503944}"
Then the omnipotent google found the answer. Php's long integer type needs to be converted using the objective int64 class. Although you output the same results in php, the query results are different. Then, add a sentence after the preceding statement.
// A required step to convert a persistent integer into a 64-bit integer $ time = new converted int64 ($ time );
Mongo extension class reference here: http://www.php.net/manual/en/mongoint64.construct.php
Original article address: php queries MongoDB for long integer data. Thank you for sharing it with the original author.