@@ -260,7 +260,7 @@ public function bulkWrite(array $operations, array $options = [])
260
260
261
261
$ operation = new BulkWrite ($ this ->databaseName , $ this ->collectionName , $ operations , $ options );
262
262
263
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
263
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
264
264
}
265
265
266
266
/**
@@ -362,7 +362,7 @@ public function createIndexes(array $indexes, array $options = [])
362
362
363
363
$ operation = new CreateIndexes ($ this ->databaseName , $ this ->collectionName , $ indexes , $ options );
364
364
365
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
365
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
366
366
}
367
367
368
368
/**
@@ -418,7 +418,7 @@ public function createSearchIndex($definition, array $options = []): string
418
418
public function createSearchIndexes (array $ indexes , array $ options = []): array
419
419
{
420
420
$ 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 );
422
422
423
423
return $ operation ->execute ($ server );
424
424
}
@@ -441,7 +441,7 @@ public function deleteMany($filter, array $options = [])
441
441
442
442
$ operation = new DeleteMany ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
443
443
444
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
444
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
445
445
}
446
446
447
447
/**
@@ -462,7 +462,7 @@ public function deleteOne($filter, array $options = [])
462
462
463
463
$ operation = new DeleteOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
464
464
465
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
465
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
466
466
}
467
467
468
468
/**
@@ -503,7 +503,7 @@ public function drop(array $options = [])
503
503
$ options = $ this ->inheritWriteOptions ($ options );
504
504
$ options = $ this ->inheritTypeMap ($ options );
505
505
506
- $ server = select_server ($ this ->manager , $ options );
506
+ $ server = select_server_for_write ($ this ->manager , $ options );
507
507
508
508
if (! isset ($ options ['encryptedFields ' ])) {
509
509
$ options ['encryptedFields ' ] = get_encrypted_fields_from_driver ($ this ->databaseName , $ this ->collectionName , $ this ->manager )
@@ -541,7 +541,7 @@ public function dropIndex($indexName, array $options = [])
541
541
542
542
$ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , $ indexName , $ options );
543
543
544
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
544
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
545
545
}
546
546
547
547
/**
@@ -561,7 +561,7 @@ public function dropIndexes(array $options = [])
561
561
562
562
$ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , '* ' , $ options );
563
563
564
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
564
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
565
565
}
566
566
567
567
/**
@@ -577,7 +577,7 @@ public function dropIndexes(array $options = [])
577
577
public function dropSearchIndex (string $ name , array $ options = []): void
578
578
{
579
579
$ operation = new DropSearchIndex ($ this ->databaseName , $ this ->collectionName , $ name );
580
- $ server = select_server ($ this ->manager , $ options );
580
+ $ server = select_server_for_write ($ this ->manager , $ options );
581
581
582
582
$ operation ->execute ($ server );
583
583
}
@@ -690,7 +690,7 @@ public function findOneAndDelete($filter, array $options = [])
690
690
691
691
$ operation = new FindOneAndDelete ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
692
692
693
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
693
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
694
694
}
695
695
696
696
/**
@@ -720,7 +720,7 @@ public function findOneAndReplace($filter, $replacement, array $options = [])
720
720
721
721
$ operation = new FindOneAndReplace ($ this ->databaseName , $ this ->collectionName , $ filter , $ replacement , $ options );
722
722
723
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
723
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
724
724
}
725
725
726
726
/**
@@ -750,7 +750,7 @@ public function findOneAndUpdate($filter, $update, array $options = [])
750
750
751
751
$ operation = new FindOneAndUpdate ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
752
752
753
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
753
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
754
754
}
755
755
756
756
/**
@@ -854,7 +854,7 @@ public function insertMany(array $documents, array $options = [])
854
854
855
855
$ operation = new InsertMany ($ this ->databaseName , $ this ->collectionName , $ documents , $ options );
856
856
857
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
857
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
858
858
}
859
859
860
860
/**
@@ -875,7 +875,7 @@ public function insertOne($document, array $options = [])
875
875
876
876
$ operation = new InsertOne ($ this ->databaseName , $ this ->collectionName , $ document , $ options );
877
877
878
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
878
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
879
879
}
880
880
881
881
/**
@@ -949,7 +949,7 @@ public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce,
949
949
950
950
$ operation = new MapReduce ($ this ->databaseName , $ this ->collectionName , $ map , $ reduce , $ out , $ options );
951
951
952
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
952
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
953
953
}
954
954
955
955
/**
@@ -975,7 +975,7 @@ public function rename(string $toCollectionName, ?string $toDatabaseName = null,
975
975
976
976
$ operation = new RenameCollection ($ this ->databaseName , $ this ->collectionName , $ toDatabaseName , $ toCollectionName , $ options );
977
977
978
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
978
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
979
979
}
980
980
981
981
/**
@@ -998,7 +998,7 @@ public function replaceOne($filter, $replacement, array $options = [])
998
998
999
999
$ operation = new ReplaceOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ replacement , $ options );
1000
1000
1001
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1001
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
1002
1002
}
1003
1003
1004
1004
/**
@@ -1020,7 +1020,7 @@ public function updateMany($filter, $update, array $options = [])
1020
1020
1021
1021
$ operation = new UpdateMany ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
1022
1022
1023
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1023
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
1024
1024
}
1025
1025
1026
1026
/**
@@ -1042,7 +1042,7 @@ public function updateOne($filter, $update, array $options = [])
1042
1042
1043
1043
$ operation = new UpdateOne ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
1044
1044
1045
- return $ operation ->execute (select_server ($ this ->manager , $ options ));
1045
+ return $ operation ->execute (select_server_for_write ($ this ->manager , $ options ));
1046
1046
}
1047
1047
1048
1048
/**
@@ -1059,7 +1059,7 @@ public function updateOne($filter, $update, array $options = [])
1059
1059
public function updateSearchIndex (string $ name , $ definition , array $ options = []): void
1060
1060
{
1061
1061
$ 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 );
1063
1063
1064
1064
$ operation ->execute ($ server );
1065
1065
}
0 commit comments