@@ -20,23 +20,31 @@ public static function create(ServerException $e): self
2020 }
2121
2222 /** @internal */
23- public static function isSearchNotSupportedError (Throwable $ e ): bool
23+ public static function isSearchNotSupportedError (Throwable $ exception ): bool
2424 {
25- if (! $ e instanceof ServerException) {
25+ if (! $ exception instanceof ServerException) {
2626 return false ;
2727 }
2828
29- return match ($ e ->getCode ()) {
29+ return match ($ exception ->getCode ()) {
3030 // MongoDB 8: Using Atlas Search Database Commands and the $listSearchIndexes aggregation stage requires additional configuration.
3131 31082 => true ,
3232 // MongoDB 7: $listSearchIndexes stage is only allowed on MongoDB Atlas
3333 6047401 => true ,
3434 // MongoDB 7-ent: Search index commands are only supported with Atlas.
3535 115 => true ,
3636 // MongoDB 4 to 6, 7-community
37- 59 => 'no such command: \'createSearchIndexes \'' === $ e ->getMessage (),
37+ 59 => match ($ exception ->getMessage ()) {
38+ 'no such command: \'createSearchIndexes \'' => true ,
39+ 'no such command: \'updateSearchIndex \'' => true ,
40+ 'no such command: \'dropSearchIndex \'' => true ,
41+ default => false ,
42+ },
3843 // MongoDB 4 to 6
39- 40324 => 'Unrecognized pipeline stage name: \'$listSearchIndexes \'' === $ e ->getMessage (),
44+ 40324 => match ($ exception ->getMessage ()) {
45+ 'Unrecognized pipeline stage name: \'$listSearchIndexes \'' => true ,
46+ default => false ,
47+ },
4048 // Not an Atlas Search error
4149 default => false ,
4250 };
0 commit comments