php7 mongodb findone,PHP7 MongoDB Invalid reply to find command

错误信息:

PHP Fatal error: Uncaught MongoDB\\Driver\\Exception\\RuntimeException: Invalid reply to find command. in .../library/MongoDB/Operation/Find.php:299

Stack trace:

#0 .../library/MongoDB/Operation/Find.php(299): MongoDB\\Driver\\Server->executeQuery('crm.t_accountin...', Object(MongoDB\\Driver\\Query), Array)

#1 .../library/MongoDB/Operation/FindOne.php(126): MongoDB\\Operation\\Find->execute(Object(MongoDB\\Driver\\Server))

#2 .../library/MongoDB/Collection.php(657): MongoDB\\Operation\\FindOne->execute(Object(MongoDB\\Driver\\Server))

#3 .../Mongo.php(211): MongoDB\\Collection->findOne(Array, Array)

#4 xxx.php(315): xxx->fetchRow('xxx...', Array, 'xxx...')

#5 xxx.php(220): xxx->fetchR in xxx/library/MongoDB/Operation/Find.php on line 299

自己操作类中的 fetchRow,其中私有函数都是些简单的转换:

/**

* 返回一行数据

*

* @param string $collectionName 集合名

* @param array $condition 条件

* @param string|null $fields 字段

* @return array|bool

*/

public function fetchRow($collectionName, $condition = [], $fields = null) {

$options = [];

if (! empty($fields)) {

$options['projection'] = $this->_toFieldsArray($fields);

}

$result = $this->getConnection()

->selectCollection($this->database, $collectionName)

->findOne($condition, $options);

$result = $this->_toArray($result);

return $this->_checkCharset($result, false);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值