Skip to content

Commit a295cd0

Browse files
authored
PHPLIB-654 Remove deprecated terminology (#828)
* Remove deprecated terminology * Update spec tests Updates spec tests to commit mongodb/specifications#6d7fd374ca14a80edabeefdd27cdd6187c43a0eb * Use ping instead of hello in docs
1 parent 2407bc4 commit a295cd0

36 files changed

+1146
-1160
lines changed

docs/reference/method/MongoDBDatabase-command.txt

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Errors/Exceptions
4343
Example
4444
-------
4545

46-
The following example executes an :manual:`isMaster
47-
</reference/command/isMaster>` command, which returns a cursor with a single
46+
The following example executes a :manual:`ping
47+
</reference/command/ping>` command, which returns a cursor with a single
4848
result document:
4949

5050
.. code-block:: php
@@ -53,32 +53,15 @@ result document:
5353

5454
$database = (new MongoDB\Client)->test;
5555

56-
$cursor = $database->command(['isMaster' => 1]);
56+
$cursor = $database->command(['ping' => 1]);
5757

5858
var_dump($c->toArray()[0]);
5959

6060
The output would resemble::
6161

6262
object(MongoDB\Model\BSONDocument)#11 (1) {
6363
["storage":"ArrayObject":private]=>
64-
array(8) {
65-
["ismaster"]=>
66-
bool(true)
67-
["maxBsonObjectSize"]=>
68-
int(16777216)
69-
["maxMessageSizeBytes"]=>
70-
int(48000000)
71-
["maxWriteBatchSize"]=>
72-
int(1000)
73-
["localTime"]=>
74-
object(MongoDB\BSON\UTCDateTime)#3 (1) {
75-
["milliseconds"]=>
76-
string(13) "1477608046464"
77-
}
78-
["maxWireVersion"]=>
79-
int(4)
80-
["minWireVersion"]=>
81-
int(0)
64+
array(1) {
8265
["ok"]=>
8366
float(1)
8467
}
@@ -94,7 +77,7 @@ multiple result documents:
9477

9578
$database = (new MongoDB\Client)->test;
9679

97-
$cursor = $database->command(['isMaster' => 1]);
80+
$cursor = $database->command(['listCollections' => 1]);
9881

9982
var_dump($c->toArray());
10083

src/ChangeStream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class ChangeStream implements Iterator
5454
189, // PrimarySteppedDown
5555
262, // ExceededTimeLimit
5656
9001, // SocketException
57-
10107, // NotMaster
57+
10107, // NotPrimary
5858
11600, // InterruptedAtShutdown
5959
11602, // InterruptedDueToReplStateChange
60-
13435, // NotMasterNoSlaveOk
61-
13436, // NotMasterOrSecondary
60+
13435, // NotPrimaryNoSecondaryOk
61+
13436, // NotPrimaryOrSecondary
6262
63, // StaleShardVersion
6363
150, // StaleEpoch
6464
13388, // StaleConfig

tests/Database/DatabaseFunctionalTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getGetDatabaseName()
8585

8686
public function testCommand()
8787
{
88-
$command = ['isMaster' => 1];
88+
$command = ['ping' => 1];
8989
$options = [
9090
'readPreference' => new ReadPreference(ReadPreference::RP_PRIMARY),
9191
];
@@ -96,8 +96,8 @@ public function testCommand()
9696
$commandResult = current($cursor->toArray());
9797

9898
$this->assertCommandSucceeded($commandResult);
99-
$this->assertObjectHasAttribute('ismaster', $commandResult);
100-
$this->assertTrue($commandResult->ismaster);
99+
$this->assertObjectHasAttribute('ok', $commandResult);
100+
$this->assertSame(1, (int) $commandResult->ok);
101101
}
102102

103103
public function testCommandDoesNotInheritReadPreference()
@@ -118,7 +118,7 @@ public function testCommandDoesNotInheritReadPreference()
118118

119119
public function testCommandAppliesTypeMapToCursor()
120120
{
121-
$command = ['isMaster' => 1];
121+
$command = ['ping' => 1];
122122
$options = [
123123
'readPreference' => new ReadPreference(ReadPreference::RP_PRIMARY),
124124
'typeMap' => ['root' => 'array'],
@@ -131,8 +131,8 @@ public function testCommandAppliesTypeMapToCursor()
131131

132132
$this->assertCommandSucceeded($commandResult);
133133
$this->assertIsArray($commandResult);
134-
$this->assertArrayHasKey('ismaster', $commandResult);
135-
$this->assertTrue($commandResult['ismaster']);
134+
$this->assertArrayHasKey('ok', $commandResult);
135+
$this->assertSame(1, (int) $commandResult['ok']);
136136
}
137137

138138
/**

tests/Operation/WatchFunctionalTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class WatchFunctionalTest extends FunctionalTestCase
4040
use SetUpTearDownTrait;
4141

4242
const INTERRUPTED = 11601;
43-
const NOT_MASTER = 10107;
43+
const NOT_PRIMARY = 10107;
4444

4545
/** @var integer */
4646
private static $wireVersionForStartAtOperationTime = 7;
@@ -1198,7 +1198,7 @@ public function testSessionFreed()
11981198

11991199
/**
12001200
* Prose test 3: "ChangeStream will automatically resume one time on a
1201-
* resumable error (including not master) with the initial pipeline and
1201+
* resumable error (including not primary) with the initial pipeline and
12021202
* options, except for the addition/update of a resumeToken."
12031203
*/
12041204
public function testResumeRepeatsOriginalPipelineAndOptions()
@@ -1212,7 +1212,7 @@ public function testResumeRepeatsOriginalPipelineAndOptions()
12121212
'mode' => ['times' => 1],
12131213
'data' => [
12141214
'failCommands' => ['getMore'],
1215-
'errorCode' => self::NOT_MASTER,
1215+
'errorCode' => self::NOT_PRIMARY,
12161216
'errorLabels' => ['ResumableChangeStreamError'],
12171217
],
12181218
]);
@@ -1568,7 +1568,7 @@ private function forceChangeStreamResume()
15681568
'mode' => ['times' => 1],
15691569
'data' => [
15701570
'failCommands' => ['getMore'],
1571-
'errorCode' => self::NOT_MASTER,
1571+
'errorCode' => self::NOT_PRIMARY,
15721572
'errorLabels' => ['ResumableChangeStreamError'],
15731573
],
15741574
]);

tests/SpecTests/ClientSideEncryptionSpecTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ public function testBypassSpawningMongocryptdViaBypassAutoEncryption()
793793
$clientMongocryptd = static::createTestClient('mongodb://localhost:27021');
794794

795795
$this->expectException(ConnectionTimeoutException::class);
796-
$clientMongocryptd->selectDatabase('db')->command(['isMaster' => true]);
796+
$clientMongocryptd->selectDatabase('db')->command(['ping' => 1]);
797797
}
798798

799799
/**

tests/SpecTests/PrimaryStepDownSpecTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PrimaryStepDownSpecTest extends FunctionalTestCase
2525
use SetUpTearDownTrait;
2626

2727
const INTERRUPTED_AT_SHUTDOWN = 11600;
28-
const NOT_MASTER = 10107;
28+
const NOT_PRIMARY = 10107;
2929
const SHUTDOWN_IN_PROGRESS = 91;
3030

3131
/** @var Client */
@@ -47,7 +47,7 @@ private function doSetUp()
4747
/**
4848
* @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id10
4949
*/
50-
public function testNotMasterKeepsConnectionPool()
50+
public function testNotPrimaryKeepsConnectionPool()
5151
{
5252
$runOn = [(object) ['minServerVersion' => '4.1.11', 'topology' => [self::TOPOLOGY_REPLICASET]]];
5353
$this->checkServerRequirements($runOn);
@@ -58,7 +58,7 @@ public function testNotMasterKeepsConnectionPool()
5858
'mode' => ['times' => 1],
5959
'data' => [
6060
'failCommands' => ['insert'],
61-
'errorCode' => self::NOT_MASTER,
61+
'errorCode' => self::NOT_PRIMARY,
6262
],
6363
]);
6464

@@ -69,7 +69,7 @@ public function testNotMasterKeepsConnectionPool()
6969
$this->insertDocuments(1);
7070
} catch (BulkWriteException $e) {
7171
// Verify that the insert failed with an operation failure with 10107 code.
72-
$this->assertSame(self::NOT_MASTER, $e->getCode());
72+
$this->assertSame(self::NOT_PRIMARY, $e->getCode());
7373
}
7474

7575
// Execute an insert into the test collection of a {test: 1} document and verify that it succeeds.
@@ -83,7 +83,7 @@ public function testNotMasterKeepsConnectionPool()
8383
/**
8484
* @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id11
8585
*/
86-
public function testNotMasterResetConnectionPool()
86+
public function testNotPrimaryResetConnectionPool()
8787
{
8888
$runOn = [(object) ['minServerVersion' => '4.0.0', 'maxServerVersion' => '4.0.999', 'topology' => [self::TOPOLOGY_REPLICASET]]];
8989
$this->checkServerRequirements($runOn);
@@ -94,7 +94,7 @@ public function testNotMasterResetConnectionPool()
9494
'mode' => ['times' => 1],
9595
'data' => [
9696
'failCommands' => ['insert'],
97-
'errorCode' => self::NOT_MASTER,
97+
'errorCode' => self::NOT_PRIMARY,
9898
],
9999
]);
100100

@@ -105,7 +105,7 @@ public function testNotMasterResetConnectionPool()
105105
$this->insertDocuments(1);
106106
} catch (BulkWriteException $e) {
107107
// Verify that the insert failed with an operation failure with 10107 code.
108-
$this->assertSame(self::NOT_MASTER, $e->getCode());
108+
$this->assertSame(self::NOT_PRIMARY, $e->getCode());
109109
}
110110

111111
// Verify that the connection pool has been cleared
@@ -248,7 +248,7 @@ function ($event) use (&$events) {
248248
$this->assertSame($totalConnectionsCreated, $this->getTotalConnectionsCreated($cursor->getServer()));
249249

250250
// Wait to allow primary election to complete and prevent subsequent test failures
251-
$this->waitForMasterReelection();
251+
$this->waitForPrimaryReelection();
252252
}
253253

254254
private function insertDocuments($count)
@@ -290,7 +290,7 @@ private function getTotalConnectionsCreated(Server $server = null)
290290
throw new UnexpectedValueException('Could not determine number of total connections');
291291
}
292292

293-
private function waitForMasterReelection()
293+
private function waitForPrimaryReelection()
294294
{
295295
try {
296296
$this->insertDocuments(1);

tests/SpecTests/retryable-reads/aggregate-serverErrors.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
]
219219
},
220220
{
221-
"description": "Aggregate succeeds after NotMaster",
221+
"description": "Aggregate succeeds after NotWritablePrimary",
222222
"failPoint": {
223223
"configureFailPoint": "failCommand",
224224
"mode": {
@@ -311,7 +311,7 @@
311311
]
312312
},
313313
{
314-
"description": "Aggregate succeeds after NotMasterNoSlaveOk",
314+
"description": "Aggregate succeeds after NotPrimaryNoSecondaryOk",
315315
"failPoint": {
316316
"configureFailPoint": "failCommand",
317317
"mode": {
@@ -404,7 +404,7 @@
404404
]
405405
},
406406
{
407-
"description": "Aggregate succeeds after NotMasterOrSecondary",
407+
"description": "Aggregate succeeds after NotPrimaryOrSecondary",
408408
"failPoint": {
409409
"configureFailPoint": "failCommand",
410410
"mode": {
@@ -1055,7 +1055,7 @@
10551055
]
10561056
},
10571057
{
1058-
"description": "Aggregate fails after two NotMaster errors",
1058+
"description": "Aggregate fails after two NotWritablePrimary errors",
10591059
"failPoint": {
10601060
"configureFailPoint": "failCommand",
10611061
"mode": {
@@ -1139,7 +1139,7 @@
11391139
]
11401140
},
11411141
{
1142-
"description": "Aggregate fails after NotMaster when retryReads is false",
1142+
"description": "Aggregate fails after NotWritablePrimary when retryReads is false",
11431143
"clientOptions": {
11441144
"retryReads": false
11451145
},

tests/SpecTests/retryable-reads/changeStreams-client.watch-serverErrors.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
]
142142
},
143143
{
144-
"description": "client.watch succeeds after NotMaster",
144+
"description": "client.watch succeeds after NotWritablePrimary",
145145
"failPoint": {
146146
"configureFailPoint": "failCommand",
147147
"mode": {
@@ -196,7 +196,7 @@
196196
]
197197
},
198198
{
199-
"description": "client.watch succeeds after NotMasterNoSlaveOk",
199+
"description": "client.watch succeeds after NotPrimaryNoSecondaryOk",
200200
"failPoint": {
201201
"configureFailPoint": "failCommand",
202202
"mode": {
@@ -251,7 +251,7 @@
251251
]
252252
},
253253
{
254-
"description": "client.watch succeeds after NotMasterOrSecondary",
254+
"description": "client.watch succeeds after NotPrimaryOrSecondary",
255255
"failPoint": {
256256
"configureFailPoint": "failCommand",
257257
"mode": {
@@ -636,7 +636,7 @@
636636
]
637637
},
638638
{
639-
"description": "client.watch fails after two NotMaster errors",
639+
"description": "client.watch fails after two NotWritablePrimary errors",
640640
"failPoint": {
641641
"configureFailPoint": "failCommand",
642642
"mode": {
@@ -692,7 +692,7 @@
692692
]
693693
},
694694
{
695-
"description": "client.watch fails after NotMaster when retryReads is false",
695+
"description": "client.watch fails after NotWritablePrimary when retryReads is false",
696696
"clientOptions": {
697697
"retryReads": false
698698
},

tests/SpecTests/retryable-reads/changeStreams-db.coll.watch-serverErrors.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
]
134134
},
135135
{
136-
"description": "db.coll.watch succeeds after NotMaster",
136+
"description": "db.coll.watch succeeds after NotWritablePrimary",
137137
"failPoint": {
138138
"configureFailPoint": "failCommand",
139139
"mode": {
@@ -184,7 +184,7 @@
184184
]
185185
},
186186
{
187-
"description": "db.coll.watch succeeds after NotMasterNoSlaveOk",
187+
"description": "db.coll.watch succeeds after NotPrimaryNoSecondaryOk",
188188
"failPoint": {
189189
"configureFailPoint": "failCommand",
190190
"mode": {
@@ -235,7 +235,7 @@
235235
]
236236
},
237237
{
238-
"description": "db.coll.watch succeeds after NotMasterOrSecondary",
238+
"description": "db.coll.watch succeeds after NotPrimaryOrSecondary",
239239
"failPoint": {
240240
"configureFailPoint": "failCommand",
241241
"mode": {
@@ -592,7 +592,7 @@
592592
]
593593
},
594594
{
595-
"description": "db.coll.watch fails after two NotMaster errors",
595+
"description": "db.coll.watch fails after two NotWritablePrimary errors",
596596
"failPoint": {
597597
"configureFailPoint": "failCommand",
598598
"mode": {
@@ -644,7 +644,7 @@
644644
]
645645
},
646646
{
647-
"description": "db.coll.watch fails after NotMaster when retryReads is false",
647+
"description": "db.coll.watch fails after NotWritablePrimary when retryReads is false",
648648
"clientOptions": {
649649
"retryReads": false
650650
},

0 commit comments

Comments
 (0)