diff --git a/lib/Doctrine/ODM/MongoDB/SchemaManager.php b/lib/Doctrine/ODM/MongoDB/SchemaManager.php index c7d7f9b3b..b142f1902 100644 --- a/lib/Doctrine/ODM/MongoDB/SchemaManager.php +++ b/lib/Doctrine/ODM/MongoDB/SchemaManager.php @@ -1062,6 +1062,11 @@ private function isSearchIndexCommandException(CommandException $e): bool return true; } + // MongoDB 6.0.7+ and 7.0+: "$listSearchIndexes stage is only allowed on MongoDB Atlas" + if ($e->getMessage() === '$listSearchIndexes stage is only allowed on MongoDB Atlas') { + return true; + } + // Older server versions don't support $listSearchIndexes // We don't check for an error code here as the code is not documented and we can't rely on it return str_contains($e->getMessage(), 'Unrecognized pipeline stage name: \'$listSearchIndexes\'');