Skip to content

PHPC-693: Unacknowledged write results report null counts #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/MongoDB/WriteResult.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PHONGO_API zend_class_entry *php_phongo_writeresult_ce;

zend_object_handlers php_phongo_handler_writeresult;

/* {{{ proto integer WriteResult::getInsertedCount()
/* {{{ proto integer|null WriteResult::getInsertedCount()
Returns the number of documents that were inserted */
PHP_METHOD(WriteResult, getInsertedCount)
{
Expand All @@ -69,7 +69,7 @@ PHP_METHOD(WriteResult, getInsertedCount)
RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nInserted");
}
/* }}} */
/* {{{ proto integer WriteResult::getMatchedCount()
/* {{{ proto integer|null WriteResult::getMatchedCount()
Returns the number of documents that matched the update criteria */
PHP_METHOD(WriteResult, getMatchedCount)
{
Expand Down Expand Up @@ -105,7 +105,7 @@ PHP_METHOD(WriteResult, getModifiedCount)
RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nModified");
}
/* }}} */
/* {{{ proto integer WriteResult::getDeletedCount()
/* {{{ proto integer|null WriteResult::getDeletedCount()
Returns the number of documents that were deleted */
PHP_METHOD(WriteResult, getDeletedCount)
{
Expand All @@ -123,7 +123,7 @@ PHP_METHOD(WriteResult, getDeletedCount)
RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nRemoved");
}
/* }}} */
/* {{{ proto integer WriteResult::getUpsertedCount()
/* {{{ proto integer|null WriteResult::getUpsertedCount()
Returns the number of documents that were upserted */
PHP_METHOD(WriteResult, getUpsertedCount)
{
Expand Down
2 changes: 1 addition & 1 deletion src/libbson
2 changes: 1 addition & 1 deletion src/libmongoc
Submodule libmongoc updated 59 files
+1 −0 .gitignore
+7 −7 .mci.yml
+6 −1 CMakeLists.txt
+13 −0 NEWS
+18 −0 build/generate-future-functions.py
+21 −13 doc/mallard2man.py
+10 −9 doc/mongoc_authentication.page
+3 −3 doc/mongoc_basic_troubleshooting.page
+11 −2 doc/mongoc_bulk.page
+1 −1 doc/mongoc_collection_count.page
+5 −4 doc/mongoc_collection_stats.page
+33 −0 doc/mongoc_cursor_get_batch_size.page
+33 −0 doc/mongoc_cursor_get_id.page
+35 −0 doc/mongoc_cursor_set_batch_size.page
+7 −6 doc/mongoc_error_api.page
+1 −1 doc/mongoc_insert_flags_t.page
+2 −1 doc/mongoc_matcher.page
+1 −1 doc/mongoc_query_flags_t.page
+1 −1 doc/mongoc_reply_flags_t.page
+1 −1 doc/mongoc_update_flags_t.page
+14 −12 doc/mongoc_version.page.in
+1 −0 doc/mongoc_write_concern_is_acknowledged.page
+5 −0 examples/Makefile.am
+65 −0 examples/bulk/bulk6.c
+1 −1 src/libbson
+2 −1 src/mongoc/mongoc-bulk-operation.c
+24 −27 src/mongoc/mongoc-cluster.c
+36 −49 src/mongoc/mongoc-collection.c
+64 −39 src/mongoc/mongoc-cursor.c
+4 −0 src/mongoc/mongoc-openssl.c
+4 −0 src/mongoc/mongoc-sasl-private.h
+59 −0 src/mongoc/mongoc-sasl.c
+1 −1 src/mongoc/mongoc-server-description.c
+44 −2 src/mongoc/mongoc-topology-description.c
+3 −2 src/mongoc/mongoc-topology-scanner-private.h
+50 −26 src/mongoc/mongoc-topology-scanner.c
+52 −40 src/mongoc/mongoc-topology.c
+2 −1 src/mongoc/mongoc-write-command-private.h
+6 −5 src/mongoc/mongoc-write-command.c
+1 −1 src/mongoc/mongoc-write-concern.c
+20 −158 tests/TestSuite.c
+116 −0 tests/mock_server/future-functions.c
+24 −0 tests/mock_server/future-functions.h
+37 −0 tests/mock_server/mock-server.c
+2 −0 tests/mock_server/mock-server.h
+36 −0 tests/test-bulk.c
+6 −2 tests/test-libmongoc.c
+1 −7 tests/test-mongoc-client.c
+210 −27 tests/test-mongoc-collection.c
+170 −0 tests/test-mongoc-command-monitoring.c
+1 −6 tests/test-mongoc-database.c
+19 −19 tests/test-mongoc-gridfs.c
+190 −38 tests/test-mongoc-server-selection-errors.c
+0 −2 tests/test-mongoc-stream-tls.c
+3 −2 tests/test-mongoc-topology.c
+4 −0 tests/test-mongoc-write-concern.c
+38 −0 tests/test-sasl.c
+6 −3 tests/test-write-commands.c
+44 −45 tests/x509gen/commonName.pem
4 changes: 2 additions & 2 deletions tests/manager/manager-executeBulkWrite_error-007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ echo throws(function() use ($manager, $bulk) {
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
===DONE===
4 changes: 2 additions & 2 deletions tests/manager/manager-executeCommand_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo throws(function() use ($manager, $command) {
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
===DONE===
4 changes: 2 additions & 2 deletions tests/manager/manager-executeQuery_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo throws(function() use ($manager, $query) {
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
===DONE===
4 changes: 2 additions & 2 deletions tests/manager/manager-selectserver_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo throws(function() use ($manager, $rp) {
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
===DONE===
2 changes: 1 addition & 1 deletion tests/server/server-executeBulkWrite-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ foreach ($writeConcerns as $writeConcern) {
<?php exit(0); ?>
--EXPECT--
bool(false)
int(0)
NULL
bool(true)
int(1)
===DONE===
2 changes: 1 addition & 1 deletion tests/server/server-executeBulkWrite-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ foreach ($writeConcerns as $wc) {
<?php exit(0); ?>
--EXPECT--
bool(false)
int(0)
NULL
bool(true)
int(1)
bool(true)
Expand Down
2 changes: 1 addition & 1 deletion tests/server/server-executeBulkWrite-004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ foreach ($writeConcerns as $wc) {
<?php exit(0); ?>
--EXPECT--
bool(false)
int(0)
NULL
OK: Got MongoDB\Driver\Exception\RuntimeException
not master
OK: Got MongoDB\Driver\Exception\RuntimeException
Expand Down
2 changes: 1 addition & 1 deletion tests/server/server-executeBulkWrite-005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $server->executeCommand('local', $command);
<?php exit(0); ?>
--EXPECT--
bool(false)
int(0)
NULL
bool(true)
int(1)
===DONE===
4 changes: 2 additions & 2 deletions tests/standalone/bug0655.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ ini_set('mongodb.debug', 'off');
[%s] PHONGO: DEBUG > Connecting to 'invalid.host:27017[mongodb://invalid.host:27017]'
%a
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
%a
[%s] PHONGO: DEBUG > Applying connectTimeoutMS: 1
[%s] PHONGO: DEBUG > Connecting to 'localhost:54321[mongodb://localhost:54321]'
%a
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverselectiontryonce` set): %s
No suitable servers found (`serverSelectionTryOnce` set): %s
===DONE===
10 changes: 5 additions & 5 deletions tests/standalone/writeresult-isacknowledged-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ var_dump($result);
WriteResult::isAcknowledged(): false
object(MongoDB\Driver\WriteResult)#%d (%d) {
["nInserted"]=>
int(0)
NULL
["nMatched"]=>
int(0)
NULL
["nModified"]=>
int(0)
NULL
["nRemoved"]=>
int(0)
NULL
["nUpserted"]=>
int(0)
NULL
["upsertedIds"]=>
array(0) {
}
Expand Down