Dan*_*eVT 3 php aggregate-functions mongodb
我已将MongoDB更新为3.6版本.我在CentOS 7和PHP 5.5.38上使用PHP MongoClient.如果我运行MongoDB库的aggregateCursor方法,通过http://php.net/manual/en/mongocollection.aggregatecursor.php中报告的第一个示例,我获得以下错误消息,如下所示:
PHP Fatal error: Uncaught exception 'MongoCursorException' with message '95.110.150.99:27017: the command cursor did not return a correctly structured response'
Run Code Online (Sandbox Code Playgroud)
你对这种行为有什么看法吗?
问题出在Mongo返回的游标id中:
["id"]=>
float(6.43105103109E+18)
Run Code Online (Sandbox Code Playgroud)
要构建MongoCommandCursor对象,id应该是MongoInt64:
["id"]=>
object(MongoInt64)#5 (1) {
["value"]=>
string(12) "392143983421"
}
Run Code Online (Sandbox Code Playgroud)
可以通过设置来完成:
ini_set('mongo.native_long', false);
ini_set('mongo.long_as_object', true);
Run Code Online (Sandbox Code Playgroud)
该问题详见于:https : //derickrethans.nl/64bit-ints-in-mongodb.html
| 归档时间: |
|
| 查看次数: |
861 次 |
| 最近记录: |