File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -394,12 +394,10 @@ public function createIndex($name, array $options = []): void
394394
395395 // Ensure the collection exists before creating the search index
396396 $ this ->mongodb ->createCollection ($ name );
397- $ collection = $ this ->mongodb ->selectCollection ($ name );
398397
399398 $ collection = $ this ->mongodb ->selectCollection ($ name );
400- /** @todo accept configuration for the mapping */
401399 $ collection ->createSearchIndex (
402- $ options [ ' definition ' ] ?? self ::DEFAULT_DEFINITION ,
400+ self ::DEFAULT_DEFINITION ,
403401 ['name ' => self ::INDEX_NAME ],
404402 );
405403
@@ -410,14 +408,7 @@ public function createIndex($name, array $options = []): void
410408 'typeMap ' => ['root ' => 'bson ' ],
411409 ]);
412410
413- // Many indexes with the same name may exist on Atlas local
414- foreach ($ indexes as $ index ) {
415- if ($ index ->name === self ::INDEX_NAME && $ index ->status === 'READY ' ) {
416- return true ;
417- }
418- }
419-
420- return false ;
411+ return $ indexes ->current () && $ indexes ->current ()->status === 'READY ' ;
421412 });
422413 }
423414 }
You can’t perform that action at this time.
0 commit comments