Files
mongo/jstests/aggregation/sources/group/group_set_window_fields.js
Drew Paroski 2ea5ff720b SERVER-90185 Fix bug in TypeChecker for traverseF() and traverseP() (#21863)
GitOrigin-RevId: ca1efcb9ff6472100a0e2d5dd3f000163887f3b8
2024-05-06 20:30:26 +00:00

17 lines
445 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);