NaN comparison not aligned between query and pipeline

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The query comparison operators have a handled case for NaN

      This behavior is not aligned with the Comparison Aggregation Operators and provides different result when used i.e. in $match pipeline stage or in a $project stage.

      Query : src/mongo/db/matcher/expression_leaf.cpp

      // Special case handling for NaN. NaN is equal to NaN but
      // otherwise always compares to false.
      

      Pipeline: src/mongo/db/pipeline/value.cpp

      return compareInts(rL._storage.intValue, rR._storage.intValue);
      

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Simon
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: