@@ -260,7 +260,7 @@ public function bulkWrite(array $operations, array $options = [])
260260
261261 $ operation = new BulkWrite ($ this ->databaseName , $ this ->collectionName , $ operations , $ options );
262262
263- return $ operation ->execute (select_server ($ this ->manager , $ options ));
263+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
264264 }
265265
266266 /**
@@ -362,7 +362,7 @@ public function createIndexes(array $indexes, array $options = [])
362362
363363 $ operation = new CreateIndexes ($ this ->databaseName , $ this ->collectionName , $ indexes , $ options );
364364
365- return $ operation ->execute (select_server ($ this ->manager , $ options ));
365+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
366366 }
367367
368368 /**
@@ -418,7 +418,7 @@ public function createSearchIndex($definition, array $options = []): string
418418 public function createSearchIndexes (array $ indexes , array $ options = []): array
419419 {
420420 $ operation = new CreateSearchIndexes ($ this ->databaseName , $ this ->collectionName , $ indexes , $ options );
421- $ server = select_server ($ this ->manager , $ options );
421+ $ server = select_server_for_write ($ this ->manager , $ options );
422422
423423 return $ operation ->execute ($ server );
424424 }
@@ -441,7 +441,7 @@ public function deleteMany($filter, array $options = [])
441441
442442 $ operation = new DeleteMany ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
443443
444- return $ operation ->execute (select_server ($ this ->manager , $ options ));
444+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
445445 }
446446
447447 /**
@@ -462,7 +462,7 @@ public function deleteOne($filter, array $options = [])
462462
463463 $ operation = new DeleteOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
464464
465- return $ operation ->execute (select_server ($ this ->manager , $ options ));
465+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
466466 }
467467
468468 /**
@@ -503,7 +503,7 @@ public function drop(array $options = [])
503503 $ options = $ this ->inheritWriteOptions ($ options );
504504 $ options = $ this ->inheritTypeMap ($ options );
505505
506- $ server = select_server ($ this ->manager , $ options );
506+ $ server = select_server_for_write ($ this ->manager , $ options );
507507
508508 if (! isset ($ options ['encryptedFields ' ])) {
509509 $ options ['encryptedFields ' ] = get_encrypted_fields_from_driver ($ this ->databaseName , $ this ->collectionName , $ this ->manager )
@@ -541,7 +541,7 @@ public function dropIndex($indexName, array $options = [])
541541
542542 $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , $ indexName , $ options );
543543
544- return $ operation ->execute (select_server ($ this ->manager , $ options ));
544+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
545545 }
546546
547547 /**
@@ -561,7 +561,7 @@ public function dropIndexes(array $options = [])
561561
562562 $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , '* ' , $ options );
563563
564- return $ operation ->execute (select_server ($ this ->manager , $ options ));
564+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
565565 }
566566
567567 /**
@@ -577,7 +577,7 @@ public function dropIndexes(array $options = [])
577577 public function dropSearchIndex (string $ name , array $ options = []): void
578578 {
579579 $ operation = new DropSearchIndex ($ this ->databaseName , $ this ->collectionName , $ name );
580- $ server = select_server ($ this ->manager , $ options );
580+ $ server = select_server_for_write ($ this ->manager , $ options );
581581
582582 $ operation ->execute ($ server );
583583 }
@@ -690,7 +690,7 @@ public function findOneAndDelete($filter, array $options = [])
690690
691691 $ operation = new FindOneAndDelete ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
692692
693- return $ operation ->execute (select_server ($ this ->manager , $ options ));
693+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
694694 }
695695
696696 /**
@@ -720,7 +720,7 @@ public function findOneAndReplace($filter, $replacement, array $options = [])
720720
721721 $ operation = new FindOneAndReplace ($ this ->databaseName , $ this ->collectionName , $ filter , $ replacement , $ options );
722722
723- return $ operation ->execute (select_server ($ this ->manager , $ options ));
723+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
724724 }
725725
726726 /**
@@ -750,7 +750,7 @@ public function findOneAndUpdate($filter, $update, array $options = [])
750750
751751 $ operation = new FindOneAndUpdate ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
752752
753- return $ operation ->execute (select_server ($ this ->manager , $ options ));
753+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
754754 }
755755
756756 /**
@@ -854,7 +854,7 @@ public function insertMany(array $documents, array $options = [])
854854
855855 $ operation = new InsertMany ($ this ->databaseName , $ this ->collectionName , $ documents , $ options );
856856
857- return $ operation ->execute (select_server ($ this ->manager , $ options ));
857+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
858858 }
859859
860860 /**
@@ -875,7 +875,7 @@ public function insertOne($document, array $options = [])
875875
876876 $ operation = new InsertOne ($ this ->databaseName , $ this ->collectionName , $ document , $ options );
877877
878- return $ operation ->execute (select_server ($ this ->manager , $ options ));
878+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
879879 }
880880
881881 /**
@@ -949,7 +949,7 @@ public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce,
949949
950950 $ operation = new MapReduce ($ this ->databaseName , $ this ->collectionName , $ map , $ reduce , $ out , $ options );
951951
952- return $ operation ->execute (select_server ($ this ->manager , $ options ));
952+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
953953 }
954954
955955 /**
@@ -975,7 +975,7 @@ public function rename(string $toCollectionName, ?string $toDatabaseName = null,
975975
976976 $ operation = new RenameCollection ($ this ->databaseName , $ this ->collectionName , $ toDatabaseName , $ toCollectionName , $ options );
977977
978- return $ operation ->execute (select_server ($ this ->manager , $ options ));
978+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
979979 }
980980
981981 /**
@@ -998,7 +998,7 @@ public function replaceOne($filter, $replacement, array $options = [])
998998
999999 $ operation = new ReplaceOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ replacement , $ options );
10001000
1001- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1001+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
10021002 }
10031003
10041004 /**
@@ -1020,7 +1020,7 @@ public function updateMany($filter, $update, array $options = [])
10201020
10211021 $ operation = new UpdateMany ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
10221022
1023- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1023+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
10241024 }
10251025
10261026 /**
@@ -1042,7 +1042,7 @@ public function updateOne($filter, $update, array $options = [])
10421042
10431043 $ operation = new UpdateOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
10441044
1045- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1045+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
10461046 }
10471047
10481048 /**
@@ -1059,7 +1059,7 @@ public function updateOne($filter, $update, array $options = [])
10591059 public function updateSearchIndex (string $ name , $ definition , array $ options = []): void
10601060 {
10611061 $ operation = new UpdateSearchIndex ($ this ->databaseName , $ this ->collectionName , $ name , $ definition , $ options );
1062- $ server = select_server ($ this ->manager , $ options );
1062+ $ server = select_server_for_write ($ this ->manager , $ options );
10631063
10641064 $ operation ->execute ($ server );
10651065 }
0 commit comments