我把我的mongo从2.6更新到了4。我遇到了聚合查询的问题。我得到的信息是:the command cursor did not return a correctly structured response。
正如在this anwser中所述,我将以下配置放在
ini_set('mongo.native_long', false);
ini_set('mongo.long_as_object', true);但是现在我得到了错误Notice: Object of class MongoInt64 could not be converted to int。
有没有人知道怎么解决这个问题?
php --ri mongodb的结果
php --ri mongodb
mongodb
MongoDB support => enabled
MongoDB extension version => 1.5.5
MongoDB extension stability => stable
libbson bundled version => 1.13.0
libmongoc bundled version => 1.13.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
Directive => Local Value => Master Value
mongodb.debug => no value => no value抛出异常的代码
$queryBuilder = $this->createQueryBuilder();
return $this->createAggregationBuilder()->match()
->field('delivery')->references($delivery)
->field('dateDeleted')->equals(null)$aggregation
->group()
->field('id')
->expression(null)
->field('count')
->sum(1)->execute()->getSingleResult();发布于 2020-04-07 14:51:36
通过添加ini_options,解决了the command cursor did not return a correctly structured response的错误。但由于一些数据已经存在于数据库中,这是由旧的Mongo驱动程序创建的,它无法获取数据。
因此,我需要删除所有文档才能重新启动一个干净的数据库。
https://stackoverflow.com/questions/60850972
复制相似问题