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
394
394
395
395
// Ensure the collection exists before creating the search index
396
396
$ this ->mongodb ->createCollection ($ name );
397
- $ collection = $ this ->mongodb ->selectCollection ($ name );
398
397
399
398
$ collection = $ this ->mongodb ->selectCollection ($ name );
400
- /** @todo accept configuration for the mapping */
401
399
$ collection ->createSearchIndex (
402
- $ options [ ' definition ' ] ?? self ::DEFAULT_DEFINITION ,
400
+ self ::DEFAULT_DEFINITION ,
403
401
['name ' => self ::INDEX_NAME ],
404
402
);
405
403
@@ -410,14 +408,7 @@ public function createIndex($name, array $options = []): void
410
408
'typeMap ' => ['root ' => 'bson ' ],
411
409
]);
412
410
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 ' ;
421
412
});
422
413
}
423
414
}
You can’t perform that action at this time.
0 commit comments