Skip to content

Commit 70539db

Browse files
authored
Merge pull request #60 from xp-forge/refactor/legacy-opcodes
Remove legacy opcodes except OP_QUERY and OP_REPLY, used by "hello"
2 parents eabf2ac + fd6e80f commit 70539db

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main/php/com/mongodb/io/Connection.class.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
99
* A single connection to MongoDB server, of which more than one may exist
1010
* in the Protocol class based on read preference.
1111
*
12+
* @see https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/
1213
* @see https://docs.mongodb.com/manual/core/read-preference-mechanics/
1314
* @test com.mongodb.unittest.ConnectionTest
1415
*/
1516
class Connection {
1617
const OP_REPLY = 1;
17-
const OP_UPDATE = 2001;
18-
const OP_INSERT = 2002;
1918
const OP_QUERY = 2004;
20-
const OP_GET_MORE = 2005;
21-
const OP_DELETE = 2006;
22-
const OP_KILL_CURSORS = 2007;
2319
const OP_MSG = 2013;
20+
const OP_COMPRESSED = 2012;
2421

2522
const RSGhost = 'RSGhost';
2623
const RSPrimary = 'RSPrimary';
@@ -100,7 +97,7 @@ public function establish($options= [], $auth= null) {
10097
'application' => ['name' => $options['params']['appName'] ?? $_SERVER['argv'][0] ?? 'php'],
10198
'driver' => ['name' => 'XP MongoDB Connectivity', 'version' => '3.0.0'],
10299
'os' => ['name' => php_uname('s'), 'type' => PHP_OS, 'architecture' => php_uname('m'), 'version' => php_uname('r')]
103-
]
100+
],
104101
];
105102

106103
// If the optional field saslSupportedMechs is specified, the command also returns
@@ -162,7 +159,7 @@ public function hello($command= []) {
162159
);
163160
$document= &$reply['documents'][0];
164161

165-
// See https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#type
162+
// See https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#type
166163
if ($document['ok'] ?? false) {
167164
if (isset($document['isreplicaset'])) {
168165
$kind= self::RSGhost;

0 commit comments

Comments
 (0)