summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorFrederic Vitzikam <frederic.vitzikam@mongodb.com>2023-04-27 16:22:18 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-27 17:29:03 +0000
commit63e236b10600fe8df3eabe4758a3c012fb9fd652 (patch)
tree789c303bec88821527e5adecb16aaab8c44082ef /jstests/core
parent7cc123ecf2bbc38450ac2792203a3e41900d25a7 (diff)
downloadmongo-63e236b10600fe8df3eabe4758a3c012fb9fd652.tar.gz
SERVER-75946 Make fixes to update response in bulkWrite
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/write/bulk/bulk_write_non_retryable_cursor.js12
-rw-r--r--jstests/core/write/bulk/bulk_write_non_transaction.js87
-rw-r--r--jstests/core/write/bulk/bulk_write_update_cursor.js40
3 files changed, 87 insertions, 52 deletions
diff --git a/jstests/core/write/bulk/bulk_write_non_retryable_cursor.js b/jstests/core/write/bulk/bulk_write_non_retryable_cursor.js
index 89e066a59d7..ce25afad6aa 100644
--- a/jstests/core/write/bulk/bulk_write_non_retryable_cursor.js
+++ b/jstests/core/write/bulk/bulk_write_non_retryable_cursor.js
@@ -25,10 +25,10 @@ coll.drop();
coll1.drop();
const cursorEntryValidator = function(entry, expectedEntry) {
- assert(entry.ok == expectedEntry.ok);
- assert(entry.idx == expectedEntry.idx);
- assert(entry.n == expectedEntry.n);
- assert(entry.code == expectedEntry.code);
+ assert.eq(entry.ok, expectedEntry.ok);
+ assert.eq(entry.idx, expectedEntry.idx);
+ assert.eq(entry.n, expectedEntry.n);
+ assert.eq(entry.code, expectedEntry.code);
};
// TODO SERVER-31242 findAndModify retry doesn't apply 'fields' to response.
@@ -77,7 +77,7 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {skey: "MongoDB2"});
assert(!res.cursor.firstBatch[2]);
@@ -103,7 +103,7 @@ assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, nModified: 2});
+cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 2, nModified: 2});
assert(!res.cursor.firstBatch[2].value);
assert(!res.cursor.firstBatch[3]);
assert.sameMembers(coll.find().toArray(), [{_id: 0, skey: "MongoDB2"}, {_id: 1, skey: "MongoDB2"}]);
diff --git a/jstests/core/write/bulk/bulk_write_non_transaction.js b/jstests/core/write/bulk/bulk_write_non_transaction.js
index 967cab5da61..163ca26ef04 100644
--- a/jstests/core/write/bulk/bulk_write_non_transaction.js
+++ b/jstests/core/write/bulk/bulk_write_non_transaction.js
@@ -26,11 +26,11 @@ coll.drop();
coll1.drop();
const cursorEntryValidator = function(entry, expectedEntry) {
- assert(entry.ok == expectedEntry.ok);
- assert(entry.idx == expectedEntry.idx);
- assert(entry.n == expectedEntry.n);
- assert(entry.nModified == expectedEntry.nModified);
- assert(entry.code == expectedEntry.code);
+ assert.eq(entry.ok, expectedEntry.ok);
+ assert.eq(entry.idx, expectedEntry.idx);
+ assert.eq(entry.n, expectedEntry.n);
+ assert.eq(entry.nModified, expectedEntry.nModified);
+ assert.eq(entry.code, expectedEntry.code);
};
// Make sure invalid fields are not accepted
@@ -132,7 +132,8 @@ var res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidOptions});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, nModified: 0, code: ErrorCodes.InvalidOptions});
assert(!res.cursor.firstBatch[1]);
// Test update providing returnFields without return option.
@@ -154,7 +155,8 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 1);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.InvalidOptions});
+cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, idx: 1, n: 0, nModified: 0, code: ErrorCodes.InvalidOptions});
assert(!res.cursor.firstBatch[2]);
coll.drop();
@@ -175,7 +177,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidNamespace});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, nModified: 0, code: ErrorCodes.InvalidNamespace});
assert(!res.cursor.firstBatch[1]);
var coll2 = db.getCollection("coll2");
@@ -204,8 +207,10 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.DuplicateKey});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 0});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, nModified: 0, code: ErrorCodes.DuplicateKey});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 0});
+
assert.docEq(res.cursor.firstBatch[1].upserted, {index: 0, _id: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[2]);
@@ -235,7 +240,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.DuplicateKey});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, nModified: 0, code: ErrorCodes.DuplicateKey});
assert(!res.cursor.firstBatch[1]);
coll.drop();
coll2.drop();
@@ -267,16 +273,18 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-assert(res.cursor.id == 0);
+assert.eq(res.cursor.id, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, n: 1, idx: 0});
// In most cases we expect this to fail because it tries to insert a document that is too large.
// In some cases we may see the javascript execution interrupted because it takes longer than
// our default time limit, so we allow that possibility.
try {
- cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.BadValue});
+ cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, n: 0, idx: 1, code: ErrorCodes.BadValue});
} catch {
- cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.Interrupted});
+ cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, n: 0, idx: 1, code: ErrorCodes.Interrupted});
}
cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, n: 1, idx: 2});
assert(!res.cursor.firstBatch[3]);
@@ -298,16 +306,18 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-assert(res.cursor.id == 0);
+assert.eq(res.cursor.id, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, n: 1, idx: 0});
// In most cases we expect this to fail because it tries to insert a document that is too large.
// In some cases we may see the javascript execution interrupted because it takes longer than
// our default time limit, so we allow that possibility.
try {
- cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.BadValue});
+ cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, n: 0, idx: 1, code: ErrorCodes.BadValue});
} catch {
- cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.Interrupted});
+ cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, n: 0, idx: 1, code: ErrorCodes.Interrupted});
}
assert(!res.cursor.firstBatch[2]);
@@ -327,7 +337,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-assert(res.cursor.id == 0);
+assert.eq(res.cursor.id, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, n: 1, idx: 0});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: 11000});
// Make sure that error extra info was correctly added
@@ -355,7 +365,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-assert(res.cursor.id == 0);
+assert.eq(res.cursor.id, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, n: 1, idx: 0});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: 11000});
cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, n: 1, idx: 2});
@@ -378,7 +388,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidOptions});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, n: 0, idx: 0, code: ErrorCodes.InvalidOptions});
assert(!res.cursor.firstBatch[1]);
// Test delete providing returnFields without return option.
@@ -395,7 +406,8 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 1);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 0, idx: 1, code: ErrorCodes.InvalidOptions});
+cursorEntryValidator(res.cursor.firstBatch[1],
+ {ok: 0, n: 0, idx: 1, code: ErrorCodes.InvalidOptions});
assert(!res.cursor.firstBatch[2]);
coll.drop();
@@ -415,7 +427,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidNamespace});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, code: ErrorCodes.InvalidNamespace});
assert(!res.cursor.firstBatch[1]);
// Test delete continues on error with ordered:false.
@@ -436,7 +449,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidNamespace});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, code: ErrorCodes.InvalidNamespace});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB"});
assert(!res.cursor.firstBatch[2]);
@@ -463,7 +477,8 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 1);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 0, idx: 0, code: ErrorCodes.InvalidNamespace});
+cursorEntryValidator(res.cursor.firstBatch[0],
+ {ok: 0, idx: 0, n: 0, code: ErrorCodes.InvalidNamespace});
assert(!res.cursor.firstBatch[1]);
assert.eq(coll.findOne().skey, "MongoDB");
@@ -500,7 +515,7 @@ try {
if (processCursor) {
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
- cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+ cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB"});
cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1});
assert.docEq(res.cursor.firstBatch[2].value, {_id: 1, skey: "MongoDB2"});
@@ -536,7 +551,7 @@ if (processCursor) {
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1});
assert.docEq(res.cursor.firstBatch[2].value, {_id: 2, skey: "MongoDB"});
- cursorEntryValidator(res.cursor.firstBatch[3], {ok: 1, idx: 3, nModified: 1});
+ cursorEntryValidator(res.cursor.firstBatch[3], {ok: 1, idx: 3, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[3].value, {_id: 1, skey: "MongoDB"});
assert(!res.cursor.firstBatch[4]);
}
@@ -580,6 +595,26 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 3);
+coll.drop();
+// Checking n and nModified on update success and failure.
+res = db.adminCommand({
+ bulkWrite: 1,
+ ops: [
+ {insert: 0, document: {_id: 1, skey: "MongoDB"}},
+ {update: 0, filter: {_id: 1}, updateMods: {$set: {skey: "MongoDB2"}}},
+ {update: 0, filter: {_id: 1}, updateMods: {$set: {_id: 2}}},
+ ],
+ nsInfo: [{ns: "test.coll"}]
+});
+
+assert.commandWorked(res);
+assert.eq(res.numErrors, 1);
+
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[2],
+ {ok: 0, idx: 2, n: 0, nModified: 0, code: ErrorCodes.ImmutableField});
+assert(!res.cursor.firstBatch[3]);
coll.drop();
})();
diff --git a/jstests/core/write/bulk/bulk_write_update_cursor.js b/jstests/core/write/bulk/bulk_write_update_cursor.js
index bf4148f4fae..0b5d356beb5 100644
--- a/jstests/core/write/bulk/bulk_write_update_cursor.js
+++ b/jstests/core/write/bulk/bulk_write_update_cursor.js
@@ -21,11 +21,11 @@ coll.drop();
coll1.drop();
const cursorEntryValidator = function(entry, expectedEntry) {
- assert(entry.ok == expectedEntry.ok);
- assert(entry.idx == expectedEntry.idx);
- assert(entry.n == expectedEntry.n);
- assert(entry.nModified == expectedEntry.nModified);
- assert(entry.code == expectedEntry.code);
+ assert.eq(entry.ok, expectedEntry.ok);
+ assert.eq(entry.idx, expectedEntry.idx);
+ assert.eq(entry.n, expectedEntry.n);
+ assert.eq(entry.nModified, expectedEntry.nModified);
+ assert.eq(entry.code, expectedEntry.code);
};
// Test generic update with no return.
@@ -42,7 +42,7 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert(!res.cursor.firstBatch[1].value);
assert(!res.cursor.firstBatch[2]);
@@ -65,7 +65,7 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB"});
assert(!res.cursor.firstBatch[2]);
@@ -88,7 +88,7 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[2]);
@@ -118,7 +118,7 @@ assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[2].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[3]);
assert.sameMembers(coll.find().toArray(), [{_id: 0, skey: "MongoDB"}, {_id: 1, skey: "MongoDB2"}]);
@@ -147,7 +147,7 @@ assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[2].value, {_id: 0, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[3]);
assert.sameMembers(coll.find().toArray(), [{_id: 0, skey: "MongoDB2"}, {_id: 1, skey: "MongoDB"}]);
@@ -168,7 +168,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[0].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[1]);
@@ -190,7 +190,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 0});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 0, nModified: 0});
assert(!res.cursor.firstBatch[0].value);
assert(!res.cursor.firstBatch[1]);
@@ -217,7 +217,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 0});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1, nModified: 0});
assert.docEq(res.cursor.firstBatch[0].upserted, {index: 0, _id: 1});
assert(!res.cursor.firstBatch[0].value);
assert(!res.cursor.firstBatch[1]);
@@ -244,7 +244,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 0});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1, nModified: 0});
assert.docEq(res.cursor.firstBatch[0].upserted, {index: 0, _id: 1});
assert.docEq(res.cursor.firstBatch[0].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[1]);
@@ -267,7 +267,7 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 0, a: 3});
assert.eq(res.cursor.firstBatch[1].nModified, 1);
assert(!res.cursor.firstBatch[2]);
@@ -294,7 +294,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1, nModified: 1});
assert.eq(res.cursor.firstBatch[0].nModified, 1);
assert.docEq(res.cursor.firstBatch[0].value, {_id: 0, a: [{b: 6}, {b: 1}, {b: 2}]});
assert(!res.cursor.firstBatch[1]);
@@ -325,7 +325,7 @@ assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1});
cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[3], {ok: 1, idx: 3, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[3], {ok: 1, idx: 3, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[3].value, {_id: 0, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[4]);
@@ -350,9 +350,9 @@ assert.commandWorked(res);
assert.eq(res.numErrors, 0);
cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1});
-cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[1], {ok: 1, idx: 1, n: 1, nModified: 1});
assert.docEq(res.cursor.firstBatch[1].value, {_id: 1, skey: "MongoDB2"});
-cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, nModified: 1});
+cursorEntryValidator(res.cursor.firstBatch[2], {ok: 1, idx: 2, n: 1, nModified: 1});
assert(!res.cursor.firstBatch[3]);
assert.eq("MongoDB3", coll.findOne().skey);
@@ -377,7 +377,7 @@ res = db.adminCommand({
assert.commandWorked(res);
assert.eq(res.numErrors, 0);
-cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, nModified: 0});
+cursorEntryValidator(res.cursor.firstBatch[0], {ok: 1, idx: 0, n: 1, nModified: 0});
assert.docEq(res.cursor.firstBatch[0].upserted, {index: 0, _id: 1});
assert.docEq(res.cursor.firstBatch[0].value, {_id: 1, skey: "MongoDB2"});
assert(!res.cursor.firstBatch[1]);