BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 1.6.2
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • Environment:
      MacOS
      Mongosh v1.3.1
      MongoDB v4.0 & v4.4
    • 1
    • Iteration Porpoise, Iteration Quahog
    • Not Needed

      Problem Statement/Rationale


      Mongosh cannot process the commands below

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      
      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1.0})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      

      Steps to Reproduce

      Run the command

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})

      Expected Results

      db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      { was: 0, slowms: 100, sampleRate: 1, ok: 1 }
      

      Actual Results

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      

      Additional Notes

      It works if I convert 1 or 1.0 to double using Double()

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: Double(1)})
      { was: 0, slowms: 100, sampleRate: 1, ok: 1 }
      

            Assignee:
            Anna Henningsen
            Reporter:
            Raymond Hu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: