jstests/aggregation/sources/setWindowFields/desugar.js
// When this happens, it's always in the first stage, an $addFields.
When this happens, it's always in the first stage, an $addFields.
When this happens it ' s always in the first stage an $addFields .
function extractTmp(stages) {
    assert(stages[0].$addFields, stages);
    const tmp = Object.keys(stages[0].$addFields)[0];
    assert(tmp, stages);
    return tmp;
}
function extractTmp ( stages ) { assert ( stages [ 0 ] . $addFields , stages ) ; const tmp = Object . keys ( stages [ 0 ] . $addFields ) [ 0 ] ; assert ( tmp , stages ) ; return tmp ; }
When this happens, it's always in the first stage, an $addFields.
When this happens it ' s always in the first stage an $addFields .