diff options
author | Eric Cox <eric.cox@mongodb.com> | 2022-01-26 22:24:21 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-27 22:51:39 +0000 |
commit | 657a5af1c22609dba692a28f8995b77e26be88d7 (patch) | |
tree | 9931d8d6e47b8c83461c31b615f719583e0a7444 /jstests | |
parent | 4144aaa465fa4bef36a71caea8e9b6af3b3c7b46 (diff) | |
download | mongo-657a5af1c22609dba692a28f8995b77e26be88d7.tar.gz |
SERVER-63012 Initialize '$add' with no operands to zero when translating to SBE
(cherry picked from commit 9b3c10f0baba2522c37db5dfdb1d41c78522c20b)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/aggregation/expressions/add_empty.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/jstests/aggregation/expressions/add_empty.js b/jstests/aggregation/expressions/add_empty.js new file mode 100644 index 00000000000..99faaf417f3 --- /dev/null +++ b/jstests/aggregation/expressions/add_empty.js @@ -0,0 +1,12 @@ +// In SERVER-63012, translation of $add expression into sbe now defaults the translation of $add +// with no operands to a zero integer constant. +(function() { +"use strict"; + +const coll = db.add_empty; +coll.drop(); + +assert.commandWorked(coll.insert({x: 1})); +let result = coll.aggregate([{$project: {y: {$add: []}}}]).toArray(); +assert.eq(result[0]["y"], 0); +}()); |