diff --git a/lib/Doctrine/ODM/MongoDB/SchemaManager.php b/lib/Doctrine/ODM/MongoDB/SchemaManager.php index b142f1902..160be2328 100644 --- a/lib/Doctrine/ODM/MongoDB/SchemaManager.php +++ b/lib/Doctrine/ODM/MongoDB/SchemaManager.php @@ -413,7 +413,9 @@ public function updateDocumentSearchIndexes(string $documentName): void $definedNames = array_column($searchIndexes, 'name'); try { - $existingNames = array_column(iterator_to_array($collection->listSearchIndexes()), 'name'); + /* The typeMap option can be removed when bug is fixed in the minimum required version. + * https://jira.mongodb.org/browse/PHPLIB-1548 */ + $existingNames = array_column(iterator_to_array($collection->listSearchIndexes(['typeMap' => ['root' => 'array']])), 'name'); } catch (CommandException $e) { /* If $listSearchIndexes doesn't exist, only throw if search indexes have been defined. * If no search indexes are defined and the server doesn't support search indexes, there's @@ -465,7 +467,9 @@ public function deleteDocumentSearchIndexes(string $documentName): void $collection = $this->dm->getDocumentCollection($class->name); try { - $searchIndexes = $collection->listSearchIndexes(); + /* The typeMap option can be removed when bug is fixed in the minimum required version. + * https://jira.mongodb.org/browse/PHPLIB-1548 */ + $searchIndexes = $collection->listSearchIndexes(['typeMap' => ['root' => 'array']]); } catch (CommandException $e) { // If the server does not support search indexes, there are no indexes to remove in any case if ($this->isSearchIndexCommandException($e)) { diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 110172f14..221a7a95f 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -184,6 +184,12 @@ + + + ['root' => 'array']]]]> + ['root' => 'array']]]]> + +