SERVER-136263In Code Review
$group producing MinKey/MaxKey followed by a classic stage turns the value into an object {"": MaxKey}
With the default engine selection, when {{$group}} runs in SBE and produces MinKey or MaxKey, and a later stage runs in the classic engine (here {{$project}}), the value arrives as an object with a single empty-named field holding MinKey/MaxKey instead of MinKey/MaxKey itself. With {{forceClassicEngine}} the same pipeline returns MinKey/MaxKey. * *classic engine*: {{internalQueryFrameworkControl: forceClassicEngine}}. Check: the explain line in the output shows {{explainVersion 1}}, with {{$gro