diff options
author | James Wahlin <james.wahlin@mongodb.com> | 2019-08-14 13:52:59 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-14 13:52:59 +0000 |
commit | 39c3a5d77b976e131d37476f2e7255d6058f5093 (patch) | |
tree | 01cc28719f215b17196ec913f475cd8efda9b37d /jstests/core/shell_writeconcern.js | |
parent | 69d0dd1dc4fb1f78d21c47aa5dd82aa9077b69eb (diff) | |
download | mongo-39c3a5d77b976e131d37476f2e7255d6058f5093.tar.gz |
SERVER-42773 Replace uses of the assert.writeOK() Javascript assertion with assert.commandWorked()
Diffstat (limited to 'jstests/core/shell_writeconcern.js')
-rw-r--r-- | jstests/core/shell_writeconcern.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/jstests/core/shell_writeconcern.js b/jstests/core/shell_writeconcern.js index 26d68304c63..ae431dab94b 100644 --- a/jstests/core/shell_writeconcern.js +++ b/jstests/core/shell_writeconcern.js @@ -33,7 +33,7 @@ assert.eq(undefined, collB.getWriteConcern()); assert.eq(undefined, db.getWriteConcern()); // test methods, by generating an error -var res = assert.writeOK(collA.save({_id: 1}, {writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.save({_id: 1}, {writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(1, res.n, tojson(res)); assert.eq(1, res.upserted, tojson(res)); @@ -41,34 +41,34 @@ if (!db.getMongo().useWriteCommands()) { assert.eq(1, res.nUpserted, tojson(res)); } -var res = assert.writeOK(collA.update({_id: 1}, {_id: 1}, {writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.update({_id: 1}, {_id: 1}, {writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(1, res.n, tojson(res)); } else { assert.eq(1, res.nMatched, tojson(res)); } -var res = assert.writeOK(collA.update({_id: 1}, {_id: 1}, {writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.update({_id: 1}, {_id: 1}, {writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(1, res.n, tojson(res)); } else { assert.eq(1, res.nMatched, tojson(res)); } -var res = assert.writeOK(collA.insert({_id: 2}, {writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.insert({_id: 2}, {writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(0, res.n, tojson(res)); } else { assert.eq(1, res.nInserted, tojson(res)); } -var res = assert.writeOK(collA.remove({_id: 3}, {writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.remove({_id: 3}, {writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(0, res.n, tojson(res)); } else { assert.eq(0, res.nRemoved, tojson(res)); } -var res = assert.writeOK(collA.remove({}, {justOne: true, writeConcern: {w: 1}})); +var res = assert.commandWorked(collA.remove({}, {justOne: true, writeConcern: {w: 1}})); if (!db.getMongo().useWriteCommands()) { assert.eq(1, res.n, tojson(res)); } else { @@ -76,7 +76,7 @@ if (!db.getMongo().useWriteCommands()) { } // Test ordered write concern, and that the write concern isn't run/error. -assert.writeOK(collA.insert({_id: 1})); +assert.commandWorked(collA.insert({_id: 1})); var res = assert.writeError(collA.insert([{_id: 1}, {_id: 1}], {ordered: true, writeConcern: {w: 1}})); |