diff options
author | Claire Childs <claire.childs@mongodb.com> | 2020-09-17 15:48:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-18 12:50:05 +0000 |
commit | f79a6251965064176e0a61ae5b48f0f38f3b8b8c (patch) | |
tree | 7ab80ac54a553a9c70960a2249ab41df45522250 /jstests/aggregation/bugs | |
parent | eaa9b518099c250cbb3083ed84636922a5b29feb (diff) | |
download | mongo-f79a6251965064176e0a61ae5b48f0f38f3b8b8c.tar.gz |
SERVER-50663 Fix for asserting exceptions in upperlower.js
Diffstat (limited to 'jstests/aggregation/bugs')
-rw-r--r-- | jstests/aggregation/bugs/upperlower.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/jstests/aggregation/bugs/upperlower.js b/jstests/aggregation/bugs/upperlower.js index 9c30650f7b5..22b30fbe66b 100644 --- a/jstests/aggregation/bugs/upperlower.js +++ b/jstests/aggregation/bugs/upperlower.js @@ -13,19 +13,11 @@ function assertResult(expectedUpper, expectedLower, string) { } function assertException(string) { - assert.commandFailedWithCode(coll.runCommand({ - aggregate: 'aggregate', - pipeline: [{$project: {upper: {$toUpper: string}}}], - cursor: {} - }), - [16020, 16007]); + const error1 = assert.throws(() => coll.aggregate([{$project: {upper: {$toUpper: string}}}])); + assert.commandFailedWithCode(error1, [16020, 16007, ErrorCodes.TypeMismatch]); - assert.commandFailedWithCode(coll.runCommand({ - aggregate: 'aggregate', - pipeline: [{$project: {lower: {$toLower: string}}}], - cursor: {} - }), - [16020, 16007]); + const error2 = assert.throws(() => coll.aggregate([{$project: {lower: {$toLower: string}}}])); + assert.commandFailedWithCode(error2, [16020, 16007, ErrorCodes.TypeMismatch]); } // Wrong number of arguments. |