summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2014-03-17 12:13:25 -0400
committerScott Hernandez <scotthernandez@gmail.com>2014-03-18 17:19:24 -0400
commit72e9bea86f89097fb65b9d392230235069302e96 (patch)
tree13d677af24450542a8b997ef7d552f63c5fe74dc
parent3e62600166ba6207295f6dbc5348c4b6043c7ffa (diff)
downloadmongo-72e9bea86f89097fb65b9d392230235069302e96.tar.gz
SERVER-13210: include nModified for all mongod write commands
(cherry picked from commit e200a2274f34ba016a123cc4bc943dfe22426e93)
-rw-r--r--jstests/core/batch_write_command_update.js4
-rw-r--r--jstests/core/write_result.js4
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.h4
3 files changed, 6 insertions, 6 deletions
diff --git a/jstests/core/batch_write_command_update.js b/jstests/core/batch_write_command_update.js
index 7c9b052221e..ae5ec678910 100644
--- a/jstests/core/batch_write_command_update.js
+++ b/jstests/core/batch_write_command_update.js
@@ -260,7 +260,7 @@ printjson( request = {update : coll.getName(),
printjson( result = coll.runCommand(request) );
assert(result.ok);
assert.eq(2, result.n);
-assert.eq(undefined, result.nModified, "wrong nModified")
+assert.eq(0, result.nModified, "wrong nModified")
assert.eq(1, result.writeErrors.length);
assert.eq(2, result.writeErrors[0].index);
@@ -287,7 +287,7 @@ printjson( request = {update : coll.getName(),
printjson( result = coll.runCommand(request) );
assert(result.ok);
assert.eq(2, result.n);
-assert.eq(undefined, result.nModified, "wrong nModified");
+assert.eq(0, result.nModified, "wrong nModified");
assert.eq(2, result.writeErrors.length);
assert.eq(1, result.writeErrors[0].index);
diff --git a/jstests/core/write_result.js b/jstests/core/write_result.js
index c008c5ae404..1a2161873b2 100644
--- a/jstests/core/write_result.js
+++ b/jstests/core/write_result.js
@@ -111,7 +111,7 @@ printjson( result = coll.update({ foo : "bar" }, { $invalid : "expr" }) );
assert.eq(result.nUpserted, 0);
assert.eq(result.nMatched, 0);
if (coll.getMongo().writeMode() == "commands")
- assert.eq(undefined, result.nModified, result);
+ assert.eq(0, result.nModified, result);
assert(result.getWriteError());
assert(result.getWriteError().errmsg);
assert(!result.getUpsertedId());
@@ -131,7 +131,7 @@ printjson( result = coll.update({},
assert.eq(result.nUpserted, 0);
assert.eq(result.nMatched, 0);
if (coll.getMongo().writeMode() == "commands")
- assert.eq(undefined, result.nModified, result);
+ assert.eq(0, result.nModified, result);
assert(result.getWriteError());
assert(result.getWriteError().errmsg);
assert(!result.getUpsertedId());
diff --git a/src/mongo/db/commands/write_commands/batch_executor.h b/src/mongo/db/commands/write_commands/batch_executor.h
index 0f6fb25d293..4e5ce2e0aab 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.h
+++ b/src/mongo/db/commands/write_commands/batch_executor.h
@@ -150,12 +150,12 @@ namespace mongo {
struct WriteOpStats {
WriteOpStats() :
- n( 0 ), nModified( -1 ) {
+ n( 0 ), nModified( 0 ) {
}
void reset() {
n = 0;
- nModified = -1;
+ nModified = 0;
upsertedID = BSONObj();
}