Converts an exception to
public static toResultArray ( MongoDB\Driver\Exception\Exception $e ) : array | ||
$e | MongoDB\Driver\Exception\Exception | |
Résultat | array |
/** * Execute a database command * * @link http://www.php.net/manual/en/mongodb.command.php * @param array $data The query to send. * @param array $options * @return array Returns database response. */ public function command(array $data, $options = [], &$hash = null) { try { $cursor = new \MongoCommandCursor($this->connection, $this->name, $data); $cursor->setReadPreference($this->getReadPreference()); return iterator_to_array($cursor)[0]; } catch (\MongoDB\Driver\Exception\Exception $e) { return ExceptionConverter::toResultArray($e); } }
/** * Delete all indexes for this collection * * @link http://www.php.net/manual/en/mongocollection.deleteindexes.php * @return array Returns the database response. */ public function deleteIndexes() { try { return TypeConverter::toLegacy($this->collection->dropIndexes()); } catch (\MongoDB\Driver\Exception\Exception $e) { return ExceptionConverter::toResultArray($e); } }