Files
mongo/jstests/aggregation/sources/group/group_set_window_fields.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

16 lines
441 B
JavaScript

/*
* Test that $group works when Nothing is passed in for _id. This is intended to reproduce
* SERVER-90185.
*/
const coll = db.group_set_window_fields;
coll.drop();
assert.commandWorked(coll.insert({_id: 1}));
const pipeline = [{$setWindowFields: {output: {obj: {$first: null}}}}, {$group: {_id: "$obj.nonexistent"}}];
const expected = [{_id: null}];
const results = coll.aggregate(pipeline).toArray();
assert.eq(results, expected);