error message:
PHP Fatal error: Uncaught MongoDB\\Driver\\Exception\\RuntimeException: Invalid reply to find command. in .../library/MongoDB/Operation/Find.php:299
Stack trace:
-sharp0 .../library/MongoDB/Operation/Find.php(299): MongoDB\\Driver\\Server->executeQuery("crm.t_accountin...", Object(MongoDB\\Driver\\Query), Array)
-sharp1 .../library/MongoDB/Operation/FindOne.php(126): MongoDB\\Operation\\Find->execute(Object(MongoDB\\Driver\\Server))
-sharp2 .../library/MongoDB/Collection.php(657): MongoDB\\Operation\\FindOne->execute(Object(MongoDB\\Driver\\Server))
-sharp3 .../Mongo.php(211): MongoDB\\Collection->findOne(Array, Array)
-sharp4 xxx.php(315): xxx->fetchRow("xxx...", Array, "xxx...")
-sharp5 xxx.php(220): xxx->fetchR in xxx/library/MongoDB/Operation/Find.php on line 299
some people on the website say that this problem has been fixed in 1.2 version:
PHPC-625
mongodb/mongo-php-driver-sharp527
syntax is based on php-library findOne document .
manipulate fetchRow
in the class by yourself, where private functions are all simple transformations:
/**
*
*
* @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);
}