Skip to content

Commit f5e7238

Browse files
committed
Remove BulkWriteCommandResult::getServer()
Per CDRIVER-5843, libmongoc does not consistently populate this field. It also isn't required by the spec, so omit it for now.
1 parent f2f3523 commit f5e7238

12 files changed

+1
-62
lines changed

src/MongoDB/BulkWriteCommandResult.c

-29
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "phongo_error.h"
2828

2929
#include "BSON/Document.h"
30-
#include "MongoDB/Server.h"
3130
#include "MongoDB/WriteConcernError.h"
3231
#include "MongoDB/WriteError.h"
3332
#include "BulkWriteCommandResult_arginfo.h"
@@ -192,21 +191,6 @@ static PHP_METHOD(MongoDB_Driver_BulkWriteCommandResult, getUpsertedCount)
192191
RETURN_LONG(intern->upserted_count);
193192
}
194193

195-
/* Returns the last Server used to execute a command for the bulk write */
196-
static PHP_METHOD(MongoDB_Driver_BulkWriteCommandResult, getServer)
197-
{
198-
php_phongo_bulkwritecommandresult_t* intern;
199-
200-
intern = Z_BULKWRITECOMMANDRESULT_OBJ_P(getThis());
201-
202-
PHONGO_PARSE_PARAMETERS_NONE();
203-
204-
PHONGO_BULKWRITECOMMANDRESULT_CHECK_ACKNOWLEDGED("getServer");
205-
206-
// TODO: null handling
207-
phongo_server_init(return_value, &intern->manager, intern->server_id);
208-
}
209-
210194
static PHP_METHOD(MongoDB_Driver_BulkWriteCommandResult, getInsertResults)
211195
{
212196
php_phongo_bulkwritecommandresult_t* intern;
@@ -401,17 +385,6 @@ static HashTable* php_phongo_bulkwritecommandresult_get_debug_info(zend_object*
401385
ADD_ASSOC_NULL_EX(&retval, "errorReply");
402386
}
403387

404-
if (intern->server_id) {
405-
zval server;
406-
407-
phongo_server_init(&server, &intern->manager, intern->server_id);
408-
ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
409-
} else {
410-
/* TODO: Determine if this path is only reached when a partial result is
411-
* attached to a BulkWriteCommandException on an unacknowledged write. */
412-
ADD_ASSOC_NULL_EX(&retval, "server");
413-
}
414-
415388
return Z_ARRVAL(retval);
416389
}
417390

@@ -451,8 +424,6 @@ php_phongo_bulkwritecommandresult_t* phongo_bulkwritecommandresult_init(zval* re
451424
bwcr->insert_results = _bson_copy_or_null(mongoc_bulkwriteresult_insertresults(bw_ret->res));
452425
bwcr->update_results = _bson_copy_or_null(mongoc_bulkwriteresult_updateresults(bw_ret->res));
453426
bwcr->delete_results = _bson_copy_or_null(mongoc_bulkwriteresult_deleteresults(bw_ret->res));
454-
455-
bwcr->server_id = mongoc_bulkwriteresult_serverid(bw_ret->res);
456427
}
457428

458429
// Copy mongoc_bulkwriteexception_t fields

src/MongoDB/BulkWriteCommandResult.stub.php

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ final public function getUpsertedCount(): int {}
2222

2323
final public function getDeletedCount(): int {}
2424

25-
final public function getServer(): Server {}
26-
2725
final public function getInsertResults(): ?\MongoDB\BSON\Document {}
2826

2927
final public function getUpdateResults(): ?\MongoDB\BSON\Document {}

src/MongoDB/BulkWriteCommandResult_arginfo.h

+1-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/phongo_structs.h

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ typedef struct {
6565
bson_t* write_concern_errors;
6666
bson_t* error_reply;
6767
zval manager;
68-
uint32_t server_id;
6968
zend_object std;
7069
} php_phongo_bulkwritecommandresult_t;
7170

tests/bulkwritecommand/bulkwritecommand-ctor-bypassDocumentValidation-001.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
6060
}
6161
["errorReply"]=>
6262
NULL
63-
["server"]=>
64-
object(MongoDB\Driver\Server)#%d (%d) {%A
65-
}
6663
}
6764
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-bypassDocumentValidation-002.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
107107
}
108108
["errorReply"]=>
109109
NULL
110-
["server"]=>
111-
object(MongoDB\Driver\Server)#%d (%d) {%A
112-
}
113110
}
114111
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-let-001.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
6464
}
6565
["errorReply"]=>
6666
NULL
67-
["server"]=>
68-
object(MongoDB\Driver\Server)#%d (%d) {%A
69-
}
7067
}
7168
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-ordered-001.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
6868
}
6969
["errorReply"]=>
7070
NULL
71-
["server"]=>
72-
object(MongoDB\Driver\Server)#%d (%d) {%A
73-
}
7471
}
7572
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-ordered-002.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
6868
}
6969
["errorReply"]=>
7070
NULL
71-
["server"]=>
72-
object(MongoDB\Driver\Server)#%d (%d) {%A
73-
}
7471
}
7572
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-verboseresults-001.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
102102
}
103103
["errorReply"]=>
104104
NULL
105-
["server"]=>
106-
object(MongoDB\Driver\Server)#%d (%d) {%A
107-
}
108105
}
109106
===DONE===

tests/bulkwritecommand/bulkwritecommand-ctor-verboseresults-002.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
5252
}
5353
["errorReply"]=>
5454
NULL
55-
["server"]=>
56-
object(MongoDB\Driver\Server)#%d (%d) {%A
57-
}
5855
}
5956
===DONE===

tests/bulkwritecommand/manager-executeBulkWriteCommand-001.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,5 @@ object(MongoDB\Driver\BulkWriteCommandResult)#%d (%d) {
196196
}
197197
["errorReply"]=>
198198
NULL
199-
["server"]=>
200-
object(MongoDB\Driver\Server)#%d (%d) {%A
201-
}
202199
}
203200
===DONE===

0 commit comments

Comments
 (0)