MongoDB 3.6的AggregateCursor问题 [英] AggregateCursor issue with MongoDB 3.6

查看:201
本文介绍了MongoDB 3.6的AggregateCursor问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将MongoDB更新为 3.6 版本.我在CentOS 7和 PHP 5.5.38 上使用了PHP MongoClient. 如果我运行MongoDB库的aggregateCursor方法,请通过 http:/中报告的第一个示例来运行/php.net/manual/en/mongocollection.aggregatecursor.php ,我收到以下错误消息:

I've updated my MongoDB to the 3.6 version. I'm using a PHP MongoClient on CentOS 7 and PHP 5.5.38. If I run the aggregateCursor method of the MongoDB library, through the first example reported in http://php.net/manual/en/mongocollection.aggregatecursor.php, I obtain the following error message as below:

PHP Fatal error:  Uncaught exception 'MongoCursorException' with message '95.110.150.99:27017: the command cursor did not return a correctly structured response' 

您对此行为有任何想法吗?

Do you have any idea about this behaviour?

推荐答案

问题出在Mongo返回的光标ID 中:

The problem was in the cursor id returned by Mongo:

 ["id"]=>
    float(6.43105103109E+18)

要构建 MongoCommandCursor 对象, id 应该是 MongoInt64 :

["id"]=>
    object(MongoInt64)#5 (1) {
      ["value"]=>
      string(12) "392143983421"
    }

可以通过设置:

ini_set('mongo.native_long', false);
ini_set('mongo.long_as_object', true);

在以下位置详细描述了该问题: https://derickrethans.nl/64bit-ints-in-mongodb.html

The problem is described in details at: https://derickrethans.nl/64bit-ints-in-mongodb.html

这篇关于MongoDB 3.6的AggregateCursor问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆