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

agg functions which coerceToString do weird things with larger floats

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.9, 2.6.0-rc0
    • Component/s: Aggregation Framework
    • Query
    • ALL

      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.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: