$max accumulator with collation might produce incorrect result for NaN

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.3.0, 5.2.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.2
    • Hide

      Into a collection insert two documents: {n: NumberLong(98618)}, {n: NaN}, then run aggregate([\{$group: {_id: null, max: {$max:"$n}}}],{collation:{locale:"en"}}).

      In classic engine the result is "NumberLong(98618)" and in SBE it's NaN. The classic result is correct, because we consider NaN to be less than any long.

       

      Show
      Into a collection insert two documents: {n: NumberLong(98618)}, {n: NaN}, then run aggregate( [\{$group: {_id: null, max: {$max:"$n}}}] ,{collation:{locale:"en"}}). In classic engine the result is "NumberLong(98618)" and in SBE it's NaN. The classic result is correct, because we consider NaN to be less than any long.  
    • QE 2021-12-13
    • 165
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

            Assignee:
            Irina Yatsenko (Inactive)
            Reporter:
            Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: