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

NumberDecimal accepts any random string

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.3.8
    • 3.3.4
    • Shell
    • None
    • Fully Compatible
    • ALL
    • Integrate+Tuning 15 (06/03/16)

    Description

      It seems like you can pass any string random string that doesn't match an IEEE 754 decimal to NumberDecimal and the shell will happily encode it as "NaN". Should it error if the value makes no sense?

      MongoDB Enterprise repl0:PRIMARY> db.test.count()
      0
      MongoDB Enterprise repl0:PRIMARY> db.test.insert({d: NumberDecimal("this is total garbage")})
      WriteResult({ "nInserted" : 1 })
      MongoDB Enterprise repl0:PRIMARY> db.test.count()
      1
      MongoDB Enterprise repl0:PRIMARY> db.test.findOne()
      { "_id" : ObjectId("570ed43b02e7d49d28d860aa"), "d" : NumberDecimal("NaN") }
      

      Attachments

        Activity

          People

            vincent.do@mongodb.com Vincent Do
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: