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

agg functions which coerceToString do weird things with larger floats

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.9, 2.6.0-rc0
    • Fix Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
    • Operating System:
      ALL

      Description

      Some aggregation functions will turn any type into a string. This gives really strange results in an example like this:

      db.foo.insert({i:1234567});   /* this is a float*/
      db.foo.aggregate({$project:{_id:0, i:{$substr:["$i",0,3]}}}
      {"i" : "1.2" }

      Apparently it's because larger floats coerce to string of format 1.xxxe+xx

      While $strcasecmp, $substr, $toLower and $toUpper all do this, only substr makes for such bizarre manifestation.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-query Backlog - Query Team
              Reporter:
              asya Asya Kamsky
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: