diff options
Diffstat (limited to 'jstests/aggregation/expressions/filter.js')
-rw-r--r-- | jstests/aggregation/expressions/filter.js | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/jstests/aggregation/expressions/filter.js b/jstests/aggregation/expressions/filter.js index 2e7abe6b0cb..2f7014a6706 100644 --- a/jstests/aggregation/expressions/filter.js +++ b/jstests/aggregation/expressions/filter.js @@ -1,9 +1,4 @@ // Test $filter aggregation expression. -// -// @tags: [ -// # Can't set the 'failOnPoisonedFieldLookup' failpoint on mongos. -// assumes_against_mongod_not_mongos, -// ] load('jstests/aggregation/extras/utils.js'); // For assertErrorCode. load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. @@ -405,29 +400,24 @@ runAndAssert(filterDoc, expectedResults); // Test short-circuiting in $and and $or inside $filter expression. coll.drop(); -assert.commandWorked(coll.insert({_id: 0, a: [-1, -2, -3, -4]})); -try { - // Lookup of '$POISON' field will always fail with this fail point enabled. - assert.commandWorked( - db.adminCommand({configureFailPoint: "failOnPoisonedFieldLookup", mode: "alwaysOn"})); - - // Create filter with $and expression containing '$POISON' in it. - expectedResults = [ - {_id: 0, b: []}, - ]; - filterDoc = {$filter: {input: '$a', cond: {$and: [{$gt: ['$$this', 0]}, '$POISON']}}}; - runAndAssert(filterDoc, expectedResults); - - // Create filter with $or expression containing '$POISON' in it. - expectedResults = [ - {_id: 0, b: [-1, -2, -3, -4]}, - ]; - filterDoc = {$filter: {input: '$a', cond: {$or: [{$lt: ['$$this', 0]}, '$POISON']}}}; - runAndAssert(filterDoc, expectedResults); -} finally { - assert.commandWorked( - db.adminCommand({configureFailPoint: "failOnPoisonedFieldLookup", mode: "off"})); -} +assert.commandWorked(coll.insert({_id: 0, a: [-1, -2, -3, -4], zero: 0})); +// Create filter with $and expression containing $divide by zero operation in it. +expectedResults = [ + {_id: 0, b: []}, +]; +filterDoc = { + $filter: {input: '$a', cond: {$and: [{$gt: ['$$this', 0]}, {$divide: [1, '$zero']}]}} +}; +runAndAssert(filterDoc, expectedResults); + +// Create filter with $or expression containing $divide by zero operation in it. +expectedResults = [ + {_id: 0, b: [-1, -2, -3, -4]}, +]; +filterDoc = { + $filter: {input: '$a', cond: {$or: [{$lte: ['$$this', 0]}, {$divide: [1, '$zero']}]}} +}; +runAndAssert(filterDoc, expectedResults); // Create filter with $and expression containing invalid call to $ln in it. expectedResults = [ |