diff options
author | Nicholas Zolnierz <nicholas.zolnierz@mongodb.com> | 2022-02-01 13:57:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-08 15:14:33 +0000 |
commit | 4bc6d8f8a4b08d2ff848c4f56a905703453f9324 (patch) | |
tree | 289e1eeaf2e90246d824a1b86249647d33fcb3ca /jstests | |
parent | 6ca0108e4c2bac11a57ec54eb5bf3227b3085b76 (diff) | |
download | mongo-4bc6d8f8a4b08d2ff848c4f56a905703453f9324.tar.gz |
SERVER-63079 Avoid using projection parser in $setWindowFields execution
(cherry picked from commit 3688d67613ff68795b42425d9a53a24a76940b19)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/aggregation/sources/setWindowFields/parse.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/aggregation/sources/setWindowFields/parse.js b/jstests/aggregation/sources/setWindowFields/parse.js index 242bf2185da..3880d92860f 100644 --- a/jstests/aggregation/sources/setWindowFields/parse.js +++ b/jstests/aggregation/sources/setWindowFields/parse.js @@ -216,4 +216,13 @@ assert.commandFailedWithCode(run({$setWindowFields: {output: {v: {$mergeObjects: assert.commandFailedWithCode(run({$setWindowFields: {output: {v: {$accumulator: "$a"}}}}), ErrorCodes.FailedToParse, 'No such window function: $accumulator'); + +// Test that an empty object is a valid projected field. +assert.commandWorked(coll.insert({})); +assert.commandWorked(run({$setWindowFields: {output: {v: {$max: {mergeObjects: {}}}}}})); + +// However conflicting field paths is always an error. +const err = assert.commandFailedWithCode( + run({$setWindowFields: {output: {a: {$sum: 1}, 'a.b': {$sum: 1}}}}), 6307900); +assert.includes(err.errmsg, 'specification contains two conflicting paths'); })(); |