diff options
Diffstat (limited to 'jstests/aggregation/sources/setWindowFields/parse.js')
-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 63b92e952e0..d660329fdcf 100644 --- a/jstests/aggregation/sources/setWindowFields/parse.js +++ b/jstests/aggregation/sources/setWindowFields/parse.js @@ -250,4 +250,13 @@ err = assert.commandFailedWithCode( }), ErrorCodes.FailedToParse); assert.includes(err.errmsg, 'Unrecognized window function, $summ'); + +// 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. +err = assert.commandFailedWithCode( + run({$setWindowFields: {output: {a: {$sum: 1}, 'a.b': {$sum: 1}}}}), 6307900); +assert.includes(err.errmsg, 'specification contains two conflicting paths'); })(); |