Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61868

$max accumulator with collation might produce incorrect result for NaN

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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

          Assignee:
          irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
          Reporter:
          irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
          Votes:
          0 Vote for this issue
          Watchers:
          4 Start watching this issue

            Created:
            Updated:
            Resolved: