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-26 23:15:29 +0000 |
commit | 9b3c10f0baba2522c37db5dfdb1d41c78522c20b (patch) | |
tree | c9a8d6256b189ccf5d9a6aa36c495599d1130173 /jstests/aggregation/expressions | |
parent | e0d21365da8e86ce2ad10547a23c50a1104cb02d (diff) | |
download | mongo-9b3c10f0baba2522c37db5dfdb1d41c78522c20b.tar.gz |
SERVER-63012 Initialize '$add' with no operands to zero when translating to SBE
Diffstat (limited to 'jstests/aggregation/expressions')
-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); +}()); |