diff options
Diffstat (limited to 'jstests/core/getmore_invalidated_documents.js')
-rw-r--r-- | jstests/core/getmore_invalidated_documents.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/jstests/core/getmore_invalidated_documents.js b/jstests/core/getmore_invalidated_documents.js index 378fde3b02a..72acb4a7cc8 100644 --- a/jstests/core/getmore_invalidated_documents.js +++ b/jstests/core/getmore_invalidated_documents.js @@ -19,15 +19,15 @@ var y; // Case #1: Text search with deletion invalidation. t.drop(); assert.commandWorked(t.ensureIndex({a: "text"})); -assert.writeOK(t.insert({_id: 1, a: "bar"})); -assert.writeOK(t.insert({_id: 2, a: "bar"})); -assert.writeOK(t.insert({_id: 3, a: "bar"})); +assert.commandWorked(t.insert({_id: 1, a: "bar"})); +assert.commandWorked(t.insert({_id: 2, a: "bar"})); +assert.commandWorked(t.insert({_id: 3, a: "bar"})); cursor = t.find({$text: {$search: "bar"}}).batchSize(2); cursor.next(); cursor.next(); -assert.writeOK(t.remove({_id: 3})); +assert.commandWorked(t.remove({_id: 3})); // We should get back the document or not (depending on the storage engine / concurrency model). // Either is fine as long as we don't crash. @@ -37,16 +37,16 @@ assert(count === 0 || count === 1); // Case #2: Text search with mutation invalidation. t.drop(); assert.commandWorked(t.ensureIndex({a: "text"})); -assert.writeOK(t.insert({_id: 1, a: "bar"})); -assert.writeOK(t.insert({_id: 2, a: "bar"})); -assert.writeOK(t.insert({_id: 3, a: "bar"})); +assert.commandWorked(t.insert({_id: 1, a: "bar"})); +assert.commandWorked(t.insert({_id: 2, a: "bar"})); +assert.commandWorked(t.insert({_id: 3, a: "bar"})); cursor = t.find({$text: {$search: "bar"}}).batchSize(2); cursor.next(); cursor.next(); // Update the next matching doc so that it no longer matches. -assert.writeOK(t.update({_id: 3}, {$set: {a: "nomatch"}})); +assert.commandWorked(t.update({_id: 3}, {$set: {a: "nomatch"}})); // Either the cursor should skip the result that no longer matches, or we should get back the // old @@ -56,16 +56,16 @@ assert(!cursor.hasNext() || cursor.next()["a"] === "bar"); // Case #3: Merge sort with deletion invalidation. t.drop(); assert.commandWorked(t.ensureIndex({a: 1, b: 1})); -assert.writeOK(t.insert({a: 1, b: 1})); -assert.writeOK(t.insert({a: 1, b: 2})); -assert.writeOK(t.insert({a: 2, b: 3})); -assert.writeOK(t.insert({a: 2, b: 4})); +assert.commandWorked(t.insert({a: 1, b: 1})); +assert.commandWorked(t.insert({a: 1, b: 2})); +assert.commandWorked(t.insert({a: 2, b: 3})); +assert.commandWorked(t.insert({a: 2, b: 4})); cursor = t.find({a: {$in: [1, 2]}}).sort({b: 1}).batchSize(2); cursor.next(); cursor.next(); -assert.writeOK(t.remove({a: 2, b: 3})); +assert.commandWorked(t.remove({a: 2, b: 3})); count = cursor.itcount(); assert(count === 1 || count === 2); @@ -73,16 +73,16 @@ assert(count === 1 || count === 2); // Case #4: Merge sort with mutation invalidation. t.drop(); assert.commandWorked(t.ensureIndex({a: 1, b: 1})); -assert.writeOK(t.insert({a: 1, b: 1})); -assert.writeOK(t.insert({a: 1, b: 2})); -assert.writeOK(t.insert({a: 2, b: 3})); -assert.writeOK(t.insert({a: 2, b: 4})); +assert.commandWorked(t.insert({a: 1, b: 1})); +assert.commandWorked(t.insert({a: 1, b: 2})); +assert.commandWorked(t.insert({a: 2, b: 3})); +assert.commandWorked(t.insert({a: 2, b: 4})); cursor = t.find({a: {$in: [1, 2]}}).sort({b: 1}).batchSize(2); cursor.next(); cursor.next(); -assert.writeOK(t.update({a: 2, b: 3}, {$set: {a: 6}})); +assert.commandWorked(t.update({a: 2, b: 3}, {$set: {a: 6}})); // Either the cursor should skip the result that no longer matches, or we should get back the // old @@ -99,7 +99,7 @@ t.drop(); t.ensureIndex({geo: "2d"}); for (x = -1; x < 1; x++) { for (y = -1; y < 1; y++) { - assert.writeOK(t.insert({geo: [x, y]})); + assert.commandWorked(t.insert({geo: [x, y]})); } } @@ -108,7 +108,7 @@ cursor.next(); cursor.next(); // Drop all documents in the collection. -assert.writeOK(t.remove({})); +assert.commandWorked(t.remove({})); // Both MMAP v1 and doc-locking storage engines should force fetch the doc (it will be buffered // because it is the same distance from the center point as a doc already returned). @@ -119,7 +119,7 @@ t.drop(); t.ensureIndex({geo: "2dsphere"}); for (x = -1; x < 1; x++) { for (y = -1; y < 1; y++) { - assert.writeOK(t.insert({geo: [x, y]})); + assert.commandWorked(t.insert({geo: [x, y]})); } } @@ -128,7 +128,7 @@ cursor.next(); cursor.next(); // Drop all documents in the collection. -assert.writeOK(t.remove({})); +assert.commandWorked(t.remove({})); // Both MMAP v1 and doc-locking storage engines should force fetch the doc (it will be buffered // because it is the same distance from the center point as a doc already returned). @@ -138,7 +138,7 @@ assert(cursor.hasNext()); t.drop(); t.ensureIndex({geo: "2dsphere"}); for (x = 0; x < 6; x++) { - assert.writeOK(t.insert({geo: [x, x]})); + assert.commandWorked(t.insert({geo: [x, x]})); } cursor = t.find({geo: {$nearSphere: [0, 0], $maxDistance: 10}}).batchSize(2); @@ -146,7 +146,7 @@ cursor.next(); cursor.next(); // Drop all documents in the collection. -assert.writeOK(t.remove({})); +assert.commandWorked(t.remove({})); // We might force-fetch or we might skip over the deleted documents, depending on the internals // of the geo near search. Just make sure that we can exhaust the cursor without crashing. @@ -157,7 +157,7 @@ t.drop(); t.ensureIndex({geo: "2d"}); for (x = -1; x < 1; x++) { for (y = -1; y < 1; y++) { - assert.writeOK(t.insert({geo: [x, y]})); + assert.commandWorked(t.insert({geo: [x, y]})); } } @@ -166,7 +166,7 @@ cursor.next(); cursor.next(); // Update all documents in the collection to have position [15, 15]. -assert.writeOK(t.update({}, {$set: {geo: [15, 15]}}, false, true)); +assert.commandWorked(t.update({}, {$set: {geo: [15, 15]}}, false, true)); // The old version of the document should be returned (the update should not be reflected in the // results of the near search). @@ -180,7 +180,7 @@ t.drop(); t.ensureIndex({geo: "2dsphere"}); for (x = -1; x < 1; x++) { for (y = -1; y < 1; y++) { - assert.writeOK(t.insert({geo: [x, y]})); + assert.commandWorked(t.insert({geo: [x, y]})); } } @@ -189,7 +189,7 @@ cursor.next(); cursor.next(); // Update all documents in the collection to have position [15, 15]. -assert.writeOK(t.update({}, {$set: {geo: [15, 15]}}, false, true)); +assert.commandWorked(t.update({}, {$set: {geo: [15, 15]}}, false, true)); // The old version of the document should be returned (the update should not be reflected in the // results of the near search). @@ -209,7 +209,7 @@ cursor = t.find({a: {$in: [1, 2, 3]}}).sort({b: 1}).batchSize(2); cursor.next(); cursor.next(); -assert.writeOK(t.remove({a: 2})); +assert.commandWorked(t.remove({a: 2})); if (cursor.hasNext()) { assert.eq(cursor.next().b, 3); @@ -226,7 +226,7 @@ cursor = t.find({a: {$in: [1, 2, 3]}}).sort({b: 1}).batchSize(2); cursor.next(); cursor.next(); -assert.writeOK(t.update({a: 2}, {$set: {a: 4}})); +assert.commandWorked(t.update({a: 2}, {$set: {a: 4}})); count = cursor.itcount(); if (cursor.hasNext()) { |